flat: 地图
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
<block v-if="activeTab == 0">
|
||||
<view v-if="newList.length > 0">
|
||||
<block v-for="(item, index) in newList" :key="index">
|
||||
<companyList :companyitem="item"></companyList>
|
||||
<companyList :companyitem="item" :position="userLocation"></companyList>
|
||||
</block>
|
||||
</view>
|
||||
<view v-else>
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
<view v-if="companyList.length > 0">
|
||||
<block v-for="(item, index) in companyList" :key="item.id">
|
||||
<workList :companyitem="item" :near="activeTab === 0"></workList>
|
||||
<workList :companyitem="item" :position="userLocation" :near="activeTab === 0"></workList>
|
||||
</block>
|
||||
</view>
|
||||
<view v-else>
|
||||
@@ -109,7 +109,9 @@
|
||||
getcoder
|
||||
} from "@/api/map.js";
|
||||
import verticalMenu from '@/components/vertical-menu/vertical-menu.vue';
|
||||
|
||||
import {
|
||||
mapGetters
|
||||
} from 'vuex'
|
||||
export default {
|
||||
components: {
|
||||
vTabs,
|
||||
@@ -117,15 +119,16 @@
|
||||
verticalMenu,
|
||||
workList
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapGetters(['userLocation']),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
policyContentList: [],
|
||||
activeTab: 0,
|
||||
activeTab: '0',
|
||||
companyList: [],
|
||||
recommendList: [],
|
||||
newList: [],
|
||||
|
||||
nearPage: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
@@ -142,10 +145,7 @@
|
||||
total: 0
|
||||
},
|
||||
currentAddress: '',
|
||||
currentPoint: {
|
||||
latitude: 0,
|
||||
longitude: 0
|
||||
},
|
||||
|
||||
key: 'FW3BZ-6JTK6-GCUS5-MZCRR-3GPR5-HJFEI',
|
||||
open: false,
|
||||
showPopUp: false,
|
||||
@@ -157,10 +157,11 @@
|
||||
if (option.tabIndex) {
|
||||
this.activeTab = option.tabIndex
|
||||
}
|
||||
this.getData()
|
||||
this.getPolicy()
|
||||
this.$store.dispatch('getUserLocation')
|
||||
this.download()
|
||||
},
|
||||
onShow: function() {
|
||||
|
||||
const enumTitle = {
|
||||
"0": '最新零工岗位',
|
||||
"1": '最新全职岗位',
|
||||
@@ -169,7 +170,7 @@
|
||||
uni.setNavigationBarTitle({
|
||||
title: enumTitle[this.activeTab]
|
||||
})
|
||||
if (this.$store.state.user.token) {
|
||||
if (this.$api.haslogin()) {
|
||||
this.$store.dispatch('refreshAuthState').then((e) => {
|
||||
var auth = this.$store.state.auth
|
||||
if (!auth.bankCardState) {
|
||||
@@ -177,7 +178,6 @@
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const value = uni.getStorageSync('active');
|
||||
if (value) {
|
||||
this.activeTab = value;
|
||||
@@ -190,13 +190,7 @@
|
||||
},
|
||||
/*下拉刷新*/
|
||||
onPullDownRefresh: function() {
|
||||
if (!this.$store.state.user.token) {
|
||||
uni.redirectTo({
|
||||
url: "/pages/login/login"
|
||||
});
|
||||
} else {
|
||||
this.download();
|
||||
}
|
||||
this.download();
|
||||
},
|
||||
methods: {
|
||||
step() {
|
||||
@@ -228,30 +222,6 @@
|
||||
url: '/pageMy/my/resume/addSkill'
|
||||
})
|
||||
},
|
||||
/*定位*/
|
||||
getLocation: function() {
|
||||
var that = this;
|
||||
uni.getLocation({
|
||||
type: 'gcj02',
|
||||
success: function(res) {
|
||||
that.currentPoint = {
|
||||
latitude: res.latitude,
|
||||
longitude: res.longitude
|
||||
}
|
||||
// that.getAddrByPoint(res);
|
||||
that.getNearList(that.currentPoint)
|
||||
},
|
||||
complete: function(e) {}
|
||||
});
|
||||
},
|
||||
/*逆地址解析*/
|
||||
getAddrByPoint: function(point) {
|
||||
var that = this;
|
||||
var location = point.latitude + ',' + point.longitude
|
||||
getcoder(location, encodeURI(that.key), 0).then(res => {
|
||||
that.currentAddress = res.data.result.address
|
||||
});
|
||||
},
|
||||
goSeach: function() {
|
||||
uni.navigateTo({
|
||||
url: '../seach/seach'
|
||||
@@ -271,8 +241,8 @@
|
||||
this.activeTab = e;
|
||||
},
|
||||
//附近任务;
|
||||
getNearList: function(point) {
|
||||
nearMission(this.nearPage.current, this.nearPage.size).then(res => {
|
||||
getNearList: function() {
|
||||
nearMission(this.nearPage.current, this.nearPage.size, 1).then(res => {
|
||||
if (this.nearPage.current === 1) {
|
||||
this.companyList = [];
|
||||
}
|
||||
@@ -313,7 +283,7 @@
|
||||
},
|
||||
//最新任务;
|
||||
getNewList: function() {
|
||||
newMissionAll(this.newPage.current, this.newPage.size, '').then(res => {
|
||||
newMissionAll(this.newPage.current, this.newPage.size, '', 1).then(res => {
|
||||
if (this.newPage.current === 1) {
|
||||
this.newList = [];
|
||||
}
|
||||
@@ -326,32 +296,31 @@
|
||||
},
|
||||
//上拉加载
|
||||
upLoad: function() {
|
||||
if (this.activeTab === 0) {
|
||||
if (this.nearPage.current <= Math.ceil(this.nearPage.total / this.nearPage.size)) {
|
||||
this.getNearList(this.currentPoint);
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: '已经是最后一页',
|
||||
})
|
||||
}
|
||||
return
|
||||
}
|
||||
if (this.activeTab === 1) {
|
||||
if (this.recommendPage.current <= Math.ceil(this.recommendPage.total / this.recommendPage
|
||||
.size)) {
|
||||
this.getRecommendList();
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: '已经是最后一页',
|
||||
})
|
||||
}
|
||||
return
|
||||
}
|
||||
if (this.activeTab === 2) {
|
||||
if (this.activeTab === '0') {
|
||||
if (this.newPage.current <= Math.ceil(this.newPage.total / this.newPage.size)) {
|
||||
this.getNewList();
|
||||
this.getNewList()
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: '已经是最后一页',
|
||||
})
|
||||
}
|
||||
return
|
||||
}
|
||||
if (this.activeTab === '1') {
|
||||
if (this.nearPage.current <= Math.ceil(this.nearPage.total / this.nearPage.size)) {
|
||||
this.getNearList();
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: '已经是最后一页',
|
||||
})
|
||||
}
|
||||
return
|
||||
}
|
||||
if (this.activeTab === '2') {
|
||||
if (this.newPage.current <= Math.ceil(this.newPage.total / this.newPage.size)) {
|
||||
this.getPolicy();
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
@@ -365,25 +334,24 @@
|
||||
download: function() {
|
||||
console.log(this.activeTab)
|
||||
if (this.activeTab === '0') {
|
||||
this.nearPage.current = 1;
|
||||
console.log('123123')
|
||||
this.getLocation();
|
||||
this.newPage.current = 1;
|
||||
this.getNewList();
|
||||
setTimeout(function() {
|
||||
uni.stopPullDownRefresh();
|
||||
}, 1000);
|
||||
return
|
||||
}
|
||||
if (this.activeTab === '1') {
|
||||
this.recommendPage.current = 1;
|
||||
this.getRecommendList();
|
||||
this.nearPage.current = 1;
|
||||
this.getNearList();
|
||||
setTimeout(function() {
|
||||
uni.stopPullDownRefresh();
|
||||
}, 1000);
|
||||
return
|
||||
}
|
||||
if (this.activeTab === '2') {
|
||||
this.newPage.current = 1;
|
||||
this.getNewList();
|
||||
// this.newPage.current = 1;
|
||||
this.getPolicy();
|
||||
setTimeout(function() {
|
||||
uni.stopPullDownRefresh();
|
||||
}, 1000);
|
||||
@@ -391,20 +359,13 @@
|
||||
}
|
||||
},
|
||||
getData: function() {
|
||||
if (!this.$store.state.user.token) {
|
||||
uni.redirectTo({
|
||||
url: "/pages/login/login"
|
||||
});
|
||||
} else {
|
||||
uni.$emit('newsReadChange');
|
||||
this.nearPage.current = 1;
|
||||
this.recommendPage.current = 1;
|
||||
this.newPage.current = 1;
|
||||
this.getLocation();
|
||||
this.getRecommendList();
|
||||
this.getNewList();
|
||||
this.getNearList();
|
||||
}
|
||||
uni.$emit('newsReadChange');
|
||||
this.nearPage.current = 1;
|
||||
this.recommendPage.current = 1;
|
||||
this.newPage.current = 1;
|
||||
this.getRecommendList();
|
||||
this.getNewList();
|
||||
this.getNearList();
|
||||
},
|
||||
|
||||
|
||||
@@ -442,7 +403,8 @@
|
||||
.content {
|
||||
background-color: #f3f4f8;
|
||||
padding-top: 20rpx;
|
||||
min-height: 80vh;
|
||||
/* min-height: 80vh; */
|
||||
min-height: calc(100vh - var(--window-top) - var(--status-bar-height) - var(--window-bottom));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user