|
|
|
|
@ -18,7 +18,16 @@
|
|
|
|
|
<view class="g_position_rela g_flex_row_center">
|
|
|
|
|
<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_fs_16 g_fw_600 g_ml_10" style="width: 36px; display: inline-block">
|
|
|
|
|
<view v-if="cityLoading" class="g_flex_column_center">
|
|
|
|
|
<view class="loading-dot">
|
|
|
|
|
<view class="dot dot1"></view>
|
|
|
|
|
<view class="dot dot2"></view>
|
|
|
|
|
<view class="dot dot3"></view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<text v-else>{{ selectedCity }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="g_flex_column_center">
|
|
|
|
|
<view class="iconfont icon-zhankai g_fs_12" style="display: inline-block"></view>
|
|
|
|
|
</view>
|
|
|
|
|
@ -340,9 +349,11 @@ export default {
|
|
|
|
|
// 判断是否需要弹出申请加入弹窗(isAgency为false,且每天只弹一次)
|
|
|
|
|
// that.checkShowApplyModal();
|
|
|
|
|
|
|
|
|
|
that.initSelectedCityByAgencyInfo().then(() => {
|
|
|
|
|
that.loadSelectedCityFromCache().then(() => {
|
|
|
|
|
this.getList();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 尝试从缓存获取miniApp-info,如果不存在则请求API获取
|
|
|
|
|
let miniAppInfo = uni.getStorageSync("miniApp-info");
|
|
|
|
|
@ -407,6 +418,9 @@ export default {
|
|
|
|
|
isUseNewJob: getApp().globalData.isUseNewJob,
|
|
|
|
|
appid: getApp().globalData.appId,
|
|
|
|
|
selectedCity: "全国",
|
|
|
|
|
cityLoading: true,
|
|
|
|
|
currentInfo: {},
|
|
|
|
|
currentCity: "",
|
|
|
|
|
themeColor: getApp().globalData.themeColor,
|
|
|
|
|
envVersion: uni.getStorageSync("ENV_VERSION"), // 小程序环境判断
|
|
|
|
|
isMember: uni.getStorageSync("IS_MINIAPP_MEMBER"), // 登陆者是否当前小程序成员的判断
|
|
|
|
|
@ -597,6 +611,77 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
getLocation() {
|
|
|
|
|
let that = this;
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
uni.authorize({
|
|
|
|
|
scope: "scope.userLocation",
|
|
|
|
|
success() {
|
|
|
|
|
uni.getLocation({
|
|
|
|
|
type: "wgs84",
|
|
|
|
|
success(res) {
|
|
|
|
|
that.currentInfo = {
|
|
|
|
|
latitude: res.latitude,
|
|
|
|
|
longitude: res.longitude,
|
|
|
|
|
timestamp: new Date().getTime(),
|
|
|
|
|
};
|
|
|
|
|
resolve();
|
|
|
|
|
},
|
|
|
|
|
fail(err) {
|
|
|
|
|
resolve();
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
fail(err) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: "请开启定位权限以显示距职位距离",
|
|
|
|
|
icon: "none",
|
|
|
|
|
});
|
|
|
|
|
resolve();
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
getCityNameByLatLng() {
|
|
|
|
|
let that = this;
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
if (!this.currentInfo.latitude || !this.currentInfo.longitude) {
|
|
|
|
|
resolve();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.G.Get("/location/getCityNameByLatLng", { lng: this.currentInfo.longitude, lat: this.currentInfo.latitude }, (res) => {
|
|
|
|
|
if (res) {
|
|
|
|
|
that.currentCity = res.replace("市", "");
|
|
|
|
|
}
|
|
|
|
|
resolve();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
initSelectedCityByAgencyInfo() {
|
|
|
|
|
let that = this;
|
|
|
|
|
let agencyInfo = uni.getStorageSync("agencyInfo");
|
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
|
if (agencyInfo && agencyInfo.fdbHomeCity !== undefined) {
|
|
|
|
|
if (agencyInfo.fdbHomeCity == 1) {
|
|
|
|
|
that.cityLoading = false;
|
|
|
|
|
resolve();
|
|
|
|
|
} else if (agencyInfo.fdbHomeCity == 0) {
|
|
|
|
|
that.getLocation().then(() => {
|
|
|
|
|
that.getCityNameByLatLng().then(() => {
|
|
|
|
|
if (that.currentCity) {
|
|
|
|
|
that.selectedCity = that.currentCity;
|
|
|
|
|
}
|
|
|
|
|
that.cityLoading = false;
|
|
|
|
|
resolve();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
that.cityLoading = false;
|
|
|
|
|
resolve();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
checkScroll() {
|
|
|
|
|
let that = this;
|
|
|
|
|
uni
|
|
|
|
|
@ -1407,4 +1492,34 @@ export default {
|
|
|
|
|
.defaultShadow {
|
|
|
|
|
box-shadow: 0px 2px 3px 0px rgba(214, 214, 214, 0.3);
|
|
|
|
|
}
|
|
|
|
|
.loading-dot {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
height: 20px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.dot {
|
|
|
|
|
width: 4px;
|
|
|
|
|
height: 4px;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
background-color: #999;
|
|
|
|
|
margin: 0 2px;
|
|
|
|
|
animation: dotPulse 1.4s infinite ease-in-out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.dot1 { animation-delay: 0s; }
|
|
|
|
|
.dot2 { animation-delay: 0.2s; }
|
|
|
|
|
.dot3 { animation-delay: 0.4s; }
|
|
|
|
|
|
|
|
|
|
@keyframes dotPulse {
|
|
|
|
|
0%, 80%, 100% {
|
|
|
|
|
transform: scale(0);
|
|
|
|
|
opacity: 0.5;
|
|
|
|
|
}
|
|
|
|
|
40% {
|
|
|
|
|
transform: scale(1);
|
|
|
|
|
opacity: 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|