<template>
	<view class="p-home-inedx g_w_all g_bg_f_5 g_kuaishou" :class="computeCode == -1 ? 'g_flex_column_center' : ''">
		<view v-show="computeCode == -1" class="g_flex_column_center">
			<g-loading marginBottom="g_mb_130" />
		</view>
		<view v-show="computeCode > -1">
			<!-- #ifdef APP-PLUS || H5 || MP-KUAISHOU -->
			<u-navbar :is-back="false" :title="pageTitle" :background="background" title-size="36" title-color="#ffffff" :title-bold="false">
				<!-- #ifdef APP-PLUS -->
				<view class="slot-wrap g_flex_column_center g_position_rela" style="padding-left: 16px; padding-top: 10rpx" @click="handleOpenCamera">
					<i class="iconfont icon-saoyisao-hui g_c_3" style="font-size: 40rpx"></i>
				</view>
				<!-- #endif -->
			</u-navbar>
			<!-- #endif -->

			<!-- 列表区 -->
			<!--  -->

			<scroll-view class="m-list" id="listBox" :scroll-into-view="scrollTo" style="height: calc(100vh - 72px)" :scroll-y="true" @scrolltolower="reachBottom">
				<!-- #ifdef MP-WEIXIN -->
				<view class="g_position_rela g_flex_row_center g_mt_10">
					<view class="the_city g_flex_column_center" style hover-class="thover" @click="goCity">
						<view class="g_flex_row_center">
							<view class="g_fs_16 g_fw_600 g_ml_10" style="width: 36px; display: inline-block">{{ selectedCity }} </view>
							<view class="g_flex_column_center">
								<view class="iconfont icon-zhankai g_fs_12" style="display: inline-block"></view>
							</view>
						</view>
					</view>

					<!-- 搜索区 -->
					<view class="m-search g_p_10 g_pt_8 g_position_abso bg_shawdoc g_flex_1" style="top: 0" id="searchInputBox">
						<u-search height="40" 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>
						<view class="g_w_all g_h_40 g_position_abso" style="left: 0; z-index: 9999" @click.stop="goSearch"> </view>
					</view>
				</view>
				<!-- #endif -->

				<!-- #ifdef APP-PLUS || H5 || MP-TOUTIAO || MP-KUAISHOU -->
				<view>
					<view class="g_position_rela">
						<!-- 搜索区 -->
						<view class="m-search g_p_10 g_pt_8 g_position_rela bg_shawdoc" style="" id="searchInputBox">
							<u-search height="40" 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>
							<view class="g_w_all g_h_40 g_position_abso" style="left: 0; z-index: 9999; top: 0; height: 100%" @click.stop="goSearch"></view>
						</view>
					</view>
					<!-- 推广区 -->
					<promotionPanel />

					<view class="g_mb_10 g_bg_f_5 sticky g_flex_row_between">
						<view class="g_flex_1">
							<u-tabs bg-color="transparent" from="index" :list="tabInfo.list" :is-scroll="true" :current="tabInfo.active" :active-color="globalData.themeColor" bar-width="64" bar-height="6" @change="handleUpdateTab" font-size="32" duration="0.05" height="76"></u-tabs>
						</view>
						<view class="g_flex_none g_flex_column_center g_fs_17 g_pr_26 g_pb_4" style="color: #576b95; text-decoration: underline" @click="openPop"> 筛选 </view>
					</view>
					<g-yi-list-job :pt="tabInfo.active == 0 ? 0 : 120" from="home" @uploadList="getList" class="g_h_all" :list="query.list" @shareJob="shareJob" :loading="loading" :speed="speed" :query="query" :isShowLoginBtn="isLogin ? false : true" :emptyText="isLogin ? (tabInfo.active == 0 ? '嘿，这里还没有数据呢' : '您还未收藏职位，快去试试收藏职位吧') : '您还有没有登录，请登录后查看职位'" />
				</view>
				<!-- #endif -->
				<!-- #ifdef MP-WEIXIN -->
				<view>
					<view class="g_mt_10">
						<!-- 推广区 -->
						<view class="g_ml_10 g_mr_10" hover-class="none" hover-stop-propagation="false">
							<image class="g_w_all g_h_70 g_radius_8" src="https://matripe-cms.oss-cn-beijing.aliyuncs.com/2023-11-17/1a1df19f-89f5-4a8d-8888-3b050badb6c1_banner-02.jpg" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload=""> </image>
						</view>
					</view>
					<view class="g_bg_f_5 sticky g_flex_row_between flex_center" id="tttop">
						<view class="g_flex_1">
							<u-tabs bg-color="transparent" from="index" :list="tabInfo.list" :is-scroll="true" :current="tabInfo.active" :active-color="globalData.themeColor" bar-width="64" bar-height="6" @change="handleUpdateTab" font-size="34" duration="0.05" height="76"></u-tabs>
						</view>
						<view v-if="true || (isMember && hasPermission)" class="g_mr_8" @click="goShare" hover-class="none" hover-stop-propagation="false"> 批量分享 </view>

						<!-- <view class="g_flex_none g_flex_column_center g_fs_17 g_pr_26 g_pb_4" style="color: #576b95; text-decoration: underline" @click="openPop"> 筛选 </view> -->
						<view class="csbf" @click="chooseNl" data-type="special">
							筛选
							<span class="iconfont icon-shouqi g_fs_12 g_c_9 fst g_ml_4" v-if="whichOneShow == 'special'"></span>
							<span class="iconfont icon-zhankai g_fs_12 g_c_9 fst g_ml_4" v-if="whichOneShow != 'special'"></span>
							<filter v-show="whichOneShow == 'special'" ref="filterChild" :getFilterDataNew="getFilterDataNew" @filterObj="receiveFromChild"></filter>
						</view>
						<scroll-view class="filterTag display-flex bt1" v-if="getFilterData.jobCategoryLabelIds != '' || getFilterData.jobRequestLabelIds != '' || getFilterData.sex != '-1' || (getFilterData.ageRangeStr && getFilterData.ageRangeStr != '16-60')" scroll-x="true" scroll-y="false" scroll-top="0" scroll-left="0" scroll-into-view scroll-with-animation="false" enable-flex enable-back-to-top="false">
							<view class="display-flex" hover-class="none" hover-stop-propagation="false">
								<view class="tc genderTag f14 por" style="min-width: 60px" v-if="getFilterData.ageRangeStr != '' && getFilterData.ageRangeStr != '16-60'" hover-class="none" hover-stop-propagation="false">
									<view class="por" hover-class="none" hover-stop-propagation="false" @click.stop="deleteAge">
										{{ getFilterData.ageRangeStr }}
										<view class="clear_icon iconfont icon-dianji"></view>
									</view>
								</view>

								<view class="tc genderTag f14 por" style="min-width: 60px" v-if="getFilterData.sex != '-1'" hover-class="none" hover-stop-propagation="false">
									<view class="por" hover-class="none" hover-stop-propagation="false" @click.stop="deleteSex">
										{{ getFilterData.sex == 1 ? "收男工" : getFilterData.sex == 2 ? "收女工" : getFilterData.sex == 3 ? "男女都收" : "" }}
										<!-- {{getFilterData.jobCategoryLabelObjects.length > 0}} {{getFilterData.jobSpecialLabelObjects.length > 0}} -->
										<view class="clear_icon iconfont icon-dianji"></view>
									</view>
								</view>
								<view class="brandTag ml8" v-if="getFilterData.jobCategoryLabelObjects">
									<block v-for="(item, index) in getFilterData.jobCategoryLabelObjects" :key="index">
										<view class="por" @click.stop="deleteJobCategoryLabel(item.id)">
											{{ item.name }}
											<view class="clear_icon iconfont icon-dianji"></view>
										</view>
									</block>
								</view>

								<view class="specialTag ml8">
									<block v-for="(item, index) in getFilterData.jobSpecialLabelObjects" :key="index">
										<view class="por" @click.stop="deleteJobSpecialLabel(item.id)">
											{{ item.name }}
											<view class="clear_icon iconfont icon-dianji"></view>
										</view>
									</block>
								</view>
								<!-- <view class="specialTag" wx:if="{{selectJobList.length > 0}}">
                  <block wx:for="{{selectJobList}}" wx:key="index">
                    <view class="por" catchtap="deleteMark" data-item="{{item}}">
                      {{item.name}}
                      <view class="clear_icon iconfont icon-qingchu"></view>
                    </view>
                  </block>
                </view> -->
							</view>
							<view class="clear" @click.stop="clearFilter1" data-type="outerClear" hover-class="none" hover-stop-propagation="false">
								<span class="iconfont icon-shanchu f14"></span>
								清除
							</view>
						</scroll-view>
					</view>
					<!-- :isuse="tabInfo.active == 1 ? 'fujin' : 'rijie'" -->
					<g-yi-list-job :pt="tabInfo.active == 0 ? 0 : 120" from="home" class="g_h_all" :list="query.list" @clickCard="goDetail" @successLogin="successLogin" :loading="loading" :speed="speed" :query="query" :isShowLoginBtn="isLogin ? false : true" :emptyText="isLogin ? (tabInfo.active == 0 ? '嘿，这里还没有数据呢' : '您还未收藏职位，快去试试收藏职位吧') : '您还有没有登录，请登录后查看职位'" />
				</view>
				<!-- #endif -->
			</scroll-view>

			<u-popup v-model="popSelect.isShow" mode="bottom" uZindex="9999" border-radius="12" :closeable="true" :mask-close-able="true">
				<view class="g_pt_32" style="height: calc(100vh - 300rpx)">
					<selectPanel />
				</view>
			</u-popup>
		</view>
	</view>
</template>

<script>
import promotionPanel from "./child/promotion.vue";
import selectPanel from "./child/select.vue";
import filter from "./child/filter.vue";
var QQMapWX = require("../../utils/qqmap-wx-jssdk.min.js");

export default {
	components: {
		promotionPanel,
		selectPanel,
		filter,
	},
	onReady() {
		this.G.setNavStyle("home");
	},
	onShareAppMessage() {
		return this.G.shareFun();
	},
	onLoad(options) {
		console.log("options", options);
		let that = this;
		that.navInfo = that.G.getNavInfo();

		uni.setNavigationBarTitle({
			title: that.pageTitle,
		});
		if (options.userId) {
			this.userId = options.userId;
			uni.setStorageSync("AGENCY_USER_ID", this.userId);
		}
		if (options.scene) {
			console.log("XXXXXXXXXXXX");
			//扫小程序码携带参数
			var sceneStr = decodeURIComponent(options.scene);
			var sceneJson = this.G.sceneToJson(sceneStr);
			console.log("sceneJson===", sceneJson);
			this.userId = sceneJson.i.split("_")[0];
			uni.setStorageSync("AGENCY_USER_ID", this.userId);
		}

		// #ifdef MP-WEIXIN
		this.searchAnimate();
		// #endif
	},
	data() {
		return {
      globalData:getApp().globalData,
			isUseNewJob: getApp().globalData.isUseNewJob,
			appid: getApp().globalData.appId,
			selectedCity: "全国",
			envVersion: uni.getStorageSync("ENV_VERSION"), // 小程序环境判断
			isMember: uni.getStorageSync("IS_MINIAPP_MEMBER"), // 登陆者是否当前小程序成员的判断
			hasPermission: uni.getStorageSync("HAS_PERMISSION") == 1 ? true : false, // 登陆者是否有权限查看
			getFilterData: {
				sex: "-1",
				ageRangeStr: "",
				jobCategoryLabelIds: [],
				jobRequestLabelIds: [],
			},
			getFilterDataNew: {
				sex: "-1",
				jobCategoryLabelIds: [],
				jobRequestLabelIds: [],
				jobSpecialLabelObjects: [],
				jobCategoryLabelObjects: [],
			},
			scrollTo: "",
			whichOneShow: "",
			pageTitle: getApp().globalData.title,
			background: {
				backgroundColor: "#3578f6",
			},
			isShowTab: false,
			showPop: false, // 显示关注邀请弹窗显示
			attentionList: [], // 关注列表
			subAttentionList: [],
			attentionConfig: {
				num: 1,
				size: 12,
			},
			checkAll: false, // 全选
			upInfo: {
				num: 0,
				list: [],
			},
			computeCode: -1,
			isLogin: true,
			navInfo: {},
			cdnBaseImg: this.G.store().cdnBaseImg,
			localBaseImg: this.G.store().localBaseImg,
			loading: true,
			speed: -1,
			query: {
				page: 1,
				size: 50,
				list: [],
				isFinish: -1,
				ujc: 0, // 0 全部 1收藏
				sortTag: 0,
			},
			keyword: "",
			tabInfo: {
				list: [
					{
						name: "全部",
						num: 0,
						tip: 0,
						classify: 2,
					},
					{
						name: "工价",
						num: 0,
						tip: 0,
						classify: 3,
					},
					// {
					// 	name: "收藏",
					// 	num: 0,
					// 	tip: 1,
					// 	classify: 3,
					// },
					// {
					// 	name: "附近",
					// 	num: 0,
					// 	tip: 2,
					// 	classify: 2,
					// },
				],
				active: 0,
			},
			popSelect: {
				isShow: false,
			},
			// "在这里，使用世界前沿的人工智能技术，为用户甄选海量的高清美图，用更流畅，更快捷，更精准的搜索体验，带你去发现多彩的世界。"
			userId: 0,
			currentInfo: {},
			appInfo: uni.getStorageSync("miniApp-info"),
		};
	},
	mounted() {},
	onShow() {
		let that = this;
		console.log("=========", that);
		if (typeof that.$mp.page.getTabBar === "function" && that.$mp.page.getTabBar()) {
			that.$mp.page.getTabBar().setData({
				selected: 0,
				isShow: true,
			});
		}

		that.loadSelectedCityFromCache();
		that.query.page = 1;
		this.isLogin = uni.getStorageSync("apply-userinfo") ? true : false;
		this.query.size = this.isLogin ? 50 : 20;
		that.getList()

		that.isShowTab = true;
	},
	onReachBottom() {
		let that = this;
		if (!uni.getStorageSync("apply-token") && that.tabInfo.active == 1) {
			return false;
		}
		if (that.query.isFinish == -1 || that.query.isFinish == that.query.size) {
			that.query.page++;
			that.getList("concat");
		}
	},
	methods: {
		loadSelectedCityFromCache() {
			// 假设缓存中的键名为 'selectedCity'
			const cachedCity = wx.getStorageSync("selectedCity");
			if (cachedCity) {
				this.selectedCity = cachedCity;
			}
		},
		deleteSex() {
			console.log("deleteSex");
			this.getFilterData.sex = -1;
			this.getFilterDataNew.sex = -1;

			this.getFilterDataNew.jobSpecialLabelObjects = this.getFilterData.jobSpecialLabelObjects;
			this.getFilterDataNew.jobRequestLabelIds = this.getFilterData.jobRequestLabelIds;
			this.getFilterDataNew.ageRangeStr = this.getFilterData.ageRangeStr;
			this.getFilterDataNew.jobCategoryLabelObjects = this.getFilterData.jobCategoryLabelObjects;
			this.getFilterDataNew.jobCategoryLabelIds = this.getFilterData.jobCategoryLabelIds;
			this.getFilterData = this.getFilterDataNew;
			this.getList();
		},
		deleteAge() {
			console.log("deleteAge");
			this.getFilterData.ageRangeStr = "";
			this.getFilterDataNew.ageRangeStr = "";

			this.getFilterDataNew.sex = this.getFilterData.sex;
			this.getFilterDataNew.jobSpecialLabelObjects = this.getFilterData.jobSpecialLabelObjects;
			this.getFilterDataNew.jobRequestLabelIds = this.getFilterData.jobRequestLabelIds;

			this.getFilterDataNew.jobCategoryLabelObjects = this.getFilterData.jobCategoryLabelObjects;
			this.getFilterDataNew.jobCategoryLabelIds = this.getFilterData.jobCategoryLabelIds;
			this.getFilterData = this.getFilterDataNew;
			this.getList();
		},

		goNotice(e) {
			console.log(e);
		},
		deleteJobCategoryLabel(id) {
			console.log(id);

			this.getFilterDataNew.jobCategoryLabelObjects = this.getFilterData.jobCategoryLabelObjects.filter((obj) => obj.id != id);

			const idsArray = this.getFilterDataNew.jobCategoryLabelObjects.map((obj) => obj.id);
			// 将数组转换为字符串
			this.getFilterDataNew.jobCategoryLabelIds = idsArray.join(",");

			this.getFilterDataNew.sex = this.getFilterData.sex;
			this.getFilterDataNew.ageRangeStr = this.getFilterData.ageRangeStr;
			this.getFilterDataNew.jobSpecialLabelObjects = this.getFilterData.jobSpecialLabelObjects;
			this.getFilterDataNew.jobRequestLabelIds = this.getFilterData.jobRequestLabelIds;

			this.getFilterData = this.getFilterDataNew;

			this.getList();
		},
		deleteJobSpecialLabel(id) {
			this.getFilterDataNew.jobSpecialLabelObjects = this.getFilterData.jobSpecialLabelObjects.filter((obj) => obj.id != id);
			const idsArray = this.getFilterDataNew.jobSpecialLabelObjects.map((obj) => obj.id);
			// 将数组转换为字符串
			this.getFilterDataNew.jobRequestLabelIds = idsArray.join(",");

			this.getFilterDataNew.sex = this.getFilterData.sex;
			this.getFilterDataNew.ageRangeStr = this.getFilterData.ageRangeStr;
			this.getFilterDataNew.jobCategoryLabelObjects = this.getFilterData.jobCategoryLabelObjects;
			this.getFilterDataNew.jobCategoryLabelIds = this.getFilterData.jobCategoryLabelIds;

			this.getFilterData = this.getFilterDataNew;
			this.getList();
		},
		clearFilter1() {
			var that = this;
			this.getFilterDataNew.jobCategoryLabelIds = "";
			this.getFilterDataNew.jobRequestLabelIds = "";
			this.getFilterDataNew.jobCategoryLabelObjects = [];
			this.getFilterDataNew.jobSpecialLabelObjects = [];
			this.scrollTo = "";
			this.getFilterDataNew.sex = -1;
			this.getFilterDataNew.ageRangeStr = "";
			this.getFilterData = this.getFilterDataNew;
			console.log("this.getFilterData", this.getFilterData);
			console.log("this.getFilterDataNew", this.getFilterDataNew);
			this.$refs.filterChild.clearFilter();
			this.getList();

			setTimeout(() => {
				that.scrollTo = "listBox";
				console.log("aaaaaaaaa");
			}, 1);
		},
		receiveFromChild(data) {
			console.log(data);
			this.whichOneShow = "";
			this.getFilterData = data;
			this.getFilterDataNew = data;
			console.log("getFilterData in receiveFromChild", this.getFilterData);
			this.getList();
			// this.messageFromChild = data.message;
		},
		chooseNl() {
			let that = this;

			if (that.whichOneShow == "special") {
				that.whichOneShow = "";
			} else {
				that.whichOneShow = "special";
				that.scrollTo = "";
			}
			setTimeout(() => {
				that.scrollTo = "tttop";
				console.log("aaaaaaaaa");
			}, 1);
			that.$forceUpdate();
		},
		handleOpenCamera() {
			let that = this;
			that.G.handleScanCode();
		},
		goPage($path) {
			uni.navigateTo({
				url: $path,
			});
		},
		reachBottom() {
			let that = this;
			if ((!uni.getStorageSync("apply-token") && that.tabInfo.active == 1) || !this.isLogin) {
				return false;
			}
			that.query.page++;
			that.getList("concat");
		},
		getList($type = "init") {
			let that = this,
				params = {};
			params = {
				...that.getFilterData,
				pageNum: that.query.page,
				pageSize: that.query.size,
				keys: that.keyword,
				ujc: that.query.ujc,
				sortTag: that.query.sortTag,

				recruitment: 1,
				classify: 1,
				workTypeStr: "",
				jobClassify: "",
				cityName: that.selectedCity == "全国" ? "" : that.selectedCity,
				brandIds: "",
			};
			if (that.tabInfo.active == 0) {
				params.lat = "";
				params.lng = "";
				// params.sortTag = 0;
			} else {
				params.lat = that.currentInfo.latitude ? that.currentInfo.latitude : "";
				params.lng = that.currentInfo.longitude ? that.currentInfo.longitude : "";
				// params.sortTag = 2;
			}
			return new Promise((resolve, reject) => {
				let _url = that.api.new_job_list;
        console.log('_url',_url);
				that.G.Post(_url, params, (res) => {
					console.log("一才职位列表：", res);
					that.computeCode = 1;
					let resData = {};
					resData = res;

					if (resData.recordCount == 0) {
						that.loading = false;
					} else {
						that.loading = true;
					}
					that.speed = resData.recordCount;
					that.query.isFinish = resData.recordList.length;
					new Promise((reso) => {
						if (resData.recordList && resData.recordList.length > 0) {
							if (that.tabInfo.active == 1) {
								// 根据 distance 进行从小到大排序
								resData.recordList.sort((a, b) => a.distance - b.distance);
							}

							resData.recordList = that.G.toGetAddressv3(resData.recordList);
							resData.recordList = that.G.toGetAge(resData.recordList);
							// console.log("that.G.yijobCopy(resData.recordList);", that.G.yijobCopy(resData.recordList));
							if (uni.getStorageSync("JOB_REQUIRE_LIST") && Date.now() - uni.getStorageSync("JOB_REQUIRE_LIST").time < 2 * 24 * 60 * 60 * 1000) {
								resData.recordList = that.G.yijobCopy(resData.recordList);
								reso();
							} else {
								that.G.Post("/yishoudan/labels/type/app/80", {}, (res) => {
									uni.setStorageSync("JOB_REQUIRE_LIST", { data: res.labels, time: Date.now() });
									resData.recordList = that.G.yijobCopy(resData.recordList);
									reso();
								});
							}
						}
					}).then((res) => {
						console.log("res", res);
						if ($type == "init") {
							that.query.list = [];
							uni.setStorageSync("lin-liu", 0);
							uni.setStorageSync("lin-bao", 0);
							that.query.list = resData.recordList.map((item, index) => {
								item.liuNum = uni.getStorageSync("lin-liu") ? uni.getStorageSync("lin-liu") : Math.floor(Math.random() * 1000);

								return {
									...item,
									liuNum: item.liuNum,
									baoNum: uni.getStorageSync("lin-bao") ? uni.getStorageSync("lin-bao") / 10 : Math.ceil(item.liuNum / 10),
									collected: item.collected ? true : false,
									cus_price: item.salaryClassify != 7 ? that.G.getSalaryClassifyValueHtml(item.salaryClassify, item.salaryClassifyValue) : "月薪",
									gender: that.G.getGenderByMinAge(item),
								};
							});
						} else {
							that.query.list = that.query.list.concat(
								resData.recordList.map((item, index) => {
									return {
										...item,
										liuNum: item.liuNum,
										baoNum: uni.getStorageSync("lin-bao") ? uni.getStorageSync("lin-bao") / 10 : Math.ceil(item.liuNum / 10),
										collected: item.collected ? true : false,
										cus_price: item.salaryClassify != 7 ? that.G.getSalaryClassifyValueHtml(item.salaryClassify, item.salaryClassifyValue) : "月薪",
										gender: that.G.getGenderByMinAge(item),
									};
								})
							);
						}
						resolve();
					});
					console.log("resData.recordList", resData.recordList);
				});
			});
		},
		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.showModal({
			// 		title: "登录提示",
			// 		content: "该页面需要登录才能查看,是否登录",
			// 		success(res) {
			// 			if (res.confirm) {
			// 				uni.navigateTo({
			// 					url: "/pages/login/index",
			// 				});
			// 			} else {
			// 			}
			// 		},
			// 	});
			// }
		},

		/**
		 * 搜索框的滚动监听变化
		 */
		searchAnimate() {
			return;
			let that = this;
			uni
				.createSelectorQuery()
				.select("#listBox")
				.fields(
					{
						scrollOffset: true,
						size: true,
					},
					(res) => {
						that.$mp.page.animate(
							"#searchInputBox",
							[
								{
									top: "10px",
									width: "100%",
								},
								{
									top: "-48px",
									width: "70%",
								},
							],
							800,
							{
								scrollSource: "#listBox",
								timeRange: 1000,
								startScrollOffset: 0,
								endScrollOffset: 60,
							}
						);
						that.$mp.page.animate(
							".the_city",
							[
								{
									color: "#333",
								},
								{
									color: "#fff",
								},
							],
							500,
							{
								scrollSource: "#listBox",
								timeRange: 1000,
								startScrollOffset: 0,
								endScrollOffset: 90,
							}
						);
					}
				)
				.exec();
		},
		shareJob(e) {
			console.log(e);
			this.currentJob = e;
		},
		goSearch() {
			// this.G.isLogin();
			// if (this.G.isLogin()) {
			uni.navigateTo({
				url: "/root/other/search?from=home",
			});
			// }
		},
		goCity() {
			uni.navigateTo({
				url: "/root/other/city",
			});
		},
		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();
					},
				});
			});
		},
		handleUpdateTab(e) {
			console.log("获取tab数据：", e);
			let that = this;
			that.loading = true;
			that.speed = -1;
			that.tabInfo.active = e;
			// 之前的位置排序，现在不需要了
			// if (that.tabInfo.active == 1) {
			// 	that.getLocation().then((res) => {
			// 		that.getList();
			// 	});
			// } else
			if (that.tabInfo.active == 1) {
				that.query.sortTag = 1;
				that.query.page = 1;
				that.getList();
			} else {
				that.query.sortTag = 0;
				that.query.ujc = e;
				that.speed = -1;
				that.query.page = 1;
				that.getList();
			}
			/* 如需登录：
				 this.tabInfo.active = e;
				 this.query.ujc = e;
				 this.speed = 0;
				 this.query.page = 1;
				 this.query.isFinish = 0;
				 this.loading = false;
				 this.query.list = [];
				 */
		},
		// 打开弹窗
		openPop() {
			uni.navigateTo({
				url: "/root/detail/select",
			});
		},

		// 批量分享
		goShare() {
			if (this.isLogin) {
				uni.navigateTo({
					url: "/root/detail/shareJob",
				});
			} else {
				uni.showModal({
					title: "登录提示",
					content: "该页面需要登录才能查看,是否登录",
					success(res) {
						if (res.confirm) {
							uni.navigateTo({
								url: "/pages/login/index",
							});
						} else {
						}
					},
				});
			}
		},
		successLogin() {
			uni.reLaunch({
				url: "/pages/home/index",
			});
		},
	},
};
</script>

<style lang="scss">
.ml8 {
	margin-left: 8px;
}

.por {
	position: relative;
}

@font-face {
	font-family: "dongtai";
	font-display: swap;
	src: url("//at.alicdn.com/t/webfont_afw3rg7h8vi.eot");
	/* IE9*/
	src: url("//at.alicdn.com/t/webfont_afw3rg7h8vi.eot?#iefix") format("embedded-opentype"), /* IE6-IE8 */ url("//at.alicdn.com/t/webfont_afw3rg7h8vi.woff2") format("woff2"), url("//at.alicdn.com/t/webfont_afw3rg7h8vi.woff") format("woff"), /* chrome、firefox */ url("//at.alicdn.com/t/webfont_afw3rg7h8vi.ttf") format("truetype"), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url("//at.alicdn.com/t/webfont_afw3rg7h8vi.svg#NotoSansHans-DemiLight") format("svg");
	/* iOS 4.1- */
}

.dongtai {
	font-size: 30rpx;
	font-family: "dongtai";
	-webkit-text-stroke-width: 0.1px;
	// -moz-osx-font-smoothing: grayscale;
	font-weight: 600;
	color: #333;
}

.csbf {
	padding: 0px 8px;
	height: 28px;
	background-color: #fff;
	border-radius: 16px;
	text-align: center;
	font-size: 14px;
	font-weight: 400;
	color: #333333;
	line-height: 28px;
	box-sizing: border-box;
	// margin-top: 6px;
	margin-right: 12px;
}

.p-home-inedx {
	background-color: #f5f5f5;
	min-height: 100%;

	.m-more {
		position: absolute;
		left: 12rpx;
		bottom: -44rpx;
		width: 154px;
		background-color: #696969;
		box-shadow: 0px 2px 19px 0px rgba(179, 179, 179, 0.5);
		border-radius: 8px;
	}

	.suffix {
		position: absolute;
		right: 20rpx;
		top: 10px;
		z-index: 1;
		border-top-right-radius: 110rpx;
		border-bottom-right-radius: 110rpx;
	}

	// #ifdef MP-WEIXIN
	.u-border {
		border-color: #fff !important;
		background-color: #fff;
	}

	.navigatorBar .tabs {
		position: relative;
		left: 50%;
		color: #fff;
		transform: translateX(-50%);
		justify-content: center;
		box-sizing: border-box;
	}

	.sticky {
		position: sticky;
		top: 0px;
		left: 0;
		z-index: 100;
	}

	#searchInputBox {
		display: flex;
		justify-content: space-between;
		padding: 0 10px;
		top: 10px;
		box-sizing: border-box;
		position: relative;
		z-index: 9999;
		width: 100vw;
	}

	// #endif
}

.filterTag .brandTag,
.filterTag .specialTag {
	display: flex;
	/* width: 200vw; */
	position: relative;
	justify-content: start;
	align-items: center;
	flex-wrap: nowrap;
	padding-right: 8px;
	/* border-right: 1px solid #ccc; */
}

/* .filterTag .brandTag .mt10,
.filterTag .specialTag .mt10 {
  display: flex;
  justify-content: space-between;
} */
.hascontent::after {
	content: "";
	position: absolute;
	right: -10px;
	top: 50%;
	transform: translateY(-50%);
	width: 1px;
	height: 18px;
	background-color: #ccc;
}

.filterTag .brandTag.hascontent::after {
	content: "";
	position: absolute;
	right: 0;
	top: 50%;
	transform: translateY(-50%);
	width: 1px;
	height: 18px;
	background-color: #ccc;
}

.filterTag .brandTag > view,
.filterTag .specialTag > view,
.genderTag .por {
	position: relative;
	height: 28px;
	line-height: 26px;
	background-color: #e3ecfd;
	border: 1px solid #3578f6;
	border-radius: 999px;
	margin-right: 8px;
	font-size: 12px;
	color: #3578f6;
	/* min-width: 100px; */
	text-align: center;
	white-space: nowrap;
	padding: 0px 12px;
	box-sizing: border-box;
}

.genderTag {
	width: 80px;
	padding-left: 8px;
	justify-content: center !important;
}

.filterTag .brandTag > view:last-child,
.filterTag .specialTag > view:last-child {
	margin-right: 0px;
}

.filterTag .specialTag {
	// padding-left: 8px;
}

.specialnum {
	height: 16px;
	min-width: 16px !important;
	line-height: 16px;
	padding: 0px;
	font-size: 12px;
	color: #fff;
	text-align: center;
	border-radius: 999px;
	background-color: #3578f6;
}

.quickapply {
	/* position: relative; */
	display: flex;
	justify-content: space-between;
	height: 80px;
	margin: 0 10px 0;
	padding-top: 10px;
	margin-bottom: 0;
	/* background-color: #fff; */
	overflow: hidden;
}

.quickapply button {
	display: flex;
	height: 100%;
	width: 100%;
	padding: 0;
	margin: 0;
}

.sticky {
	position: sticky;
	top: 0px;
	left: 0;
	z-index: 999;
}

.quickapply button > view {
	position: relative;
	display: flex;
	justify-content: space-between;
	align-items: center;
	width: 50%;
	padding: 20px 24px;
	border-radius: 8px;
	background-color: #fff;
}

.quickapply button > view:last-child {
	margin-left: 10px;
}

.display-flex {
	display: flex;
	justify-content: space-between;
}

/* .quickapply button > view:first-child::after {
	content: "";
	width: 1px;
	height: 20px;
	position: absolute;
	right: 0;
	top: 50%;
	transform: translateY(-50%);
	background-color: #eee;
} */
.quickapply button > view .t-icon {
	width: 38px;
	height: 38px;
}

.quickapply button > view .info > view {
	text-align: left;
	line-height: 1.6;
}

.filterTag {
	display: flex;
	height: 44px;
	width: 100%;
	align-items: center;
	/* padding: 10px 0; */
	line-height: 44px;
	background-color: #f5f5f5;
	box-sizing: border-box;
	border-top: 1rpx solid #eee;
	/* margin-top: 8px; */
}

.clear {
	position: sticky;
	right: 0px;
	top: 0px;
	height: 44px;
	min-width: 60px;
	text-align: center;
	line-height: 44px;
	font-size: 14px;
	background: linear-gradient(180deg, #f5f5f5, #ffffff 23%, #ffffff 79%, #f5f5f5);
	box-shadow: -12px 0px 8px -4px rgba(206, 206, 206, 0.6);
}

.clear_icon {
	position: absolute;
	display: inline-block;
	width: 12px;
	height: 12px;
	line-height: 10px;
	border-radius: 50%;
	background-color: #fff;
	right: -2px;
	top: -2px;
	color: #aaa;
	/* font-size: 12px; */
}

.u-notice-box {
	margin-left: 0 !important;
}
</style>
