@@ -498,6 +515,8 @@ import {
getHotStoreApi,
// getCityApi,
} from '../../api/job'
+import $ from 'jquery'
+
import { moneyToFixed, getSalaryClassifyValue, isNotEmptyCheck } from '../../utils/commonUtil'
import recommend from '@/components/FirstJob/components/recommend.vue'
import { nationlist } from '../../utils/datalist'
@@ -535,6 +554,8 @@ export default {
data() {
return {
// jobMainList: [], // 职位列表
+ sortNum: 1, // 排序的标识
+ sortStr: '排序',
specialList: [], // 获取的特色列表
searchValue: '',
specialvalue: [], // 点中的特色标签
@@ -642,6 +663,8 @@ export default {
],
},
relationList: [],
+ lng: '',
+ lat: '',
}
},
// 计算属性
@@ -772,6 +795,16 @@ export default {
this.getCityWhichHasJob()
this.getHotStore()
this.hideFilterContent()
+ if (isNotEmptyCheck(localStorage.getItem('POSITION_INFO'))) {
+ let position = JSON.parse(localStorage.getItem('POSITION_INFO'))
+ let diffTime = new Date().getTime() - JSON.parse(localStorage.getItem('POSITION_INFO')).timestamp
+ if (diffTime / 3600000 > 24) {
+ this.getPosition()
+ } else {
+ this.lng = position.lng
+ this.lat = position.lat
+ }
+ }
},
/**
* el 被新创建的 vm.el 替换,并挂载到实例上去之后调用该钩子。
@@ -892,8 +925,8 @@ export default {
// var timestamp = new Date().getTime();
console.log(new Date().getTime() - JSON.parse(localStorage.getItem('SPECIALLIST')))
console.log(new Date(new Date().getTime() - JSON.parse(localStorage.getItem('SPECIALLIST'))))
- let diffTime = new Date().getTime() - JSON.parse(localStorage.getItem('SPECIALLIST'))
if (isNotEmptyCheck(localStorage.getItem('SPECIALLIST'))) {
+ let diffTime = new Date().getTime() - JSON.parse(localStorage.getItem('SPECIALLIST')).timestamp
if (diffTime / 3600000 > 2) {
console.log('======================', 'needRequest')
this.getJobSpecialList().then((res) => {
@@ -922,6 +955,7 @@ export default {
})
} else {
this.specialList = JSON.parse(localStorage.getItem('SPECIALLIST')).data
+ console.log(diffTime)
this.specialList.forEach((item) => {
if (item.typeClassify == '0') {
this.tagArray0.push(item)
@@ -990,7 +1024,7 @@ export default {
if (data.status == 200) {
let container = {
data: data.data,
- // timestamp: new Date().getTime(),
+ timestamp: new Date().getTime(),
}
// console.log(container.timestamp);
localStorage.setItem('SPECIALLIST', JSON.stringify(container))
@@ -1400,6 +1434,63 @@ export default {
}
}, 0)
},
+ /**
+ * 获取当前位置信息
+ *
+ *
+ */
+ getPosition() {
+ let that = this
+ $.ajax({
+ url: 'https://restapi.amap.com/v3/ip?key=44c6ad3624a5957505fec66f6bdd6110',
+ // type: "GET",
+ dataType: 'JSONP',
+ success: function (data) {
+ console.log(data)
+ let position = data.rectangle.split(';')
+ console.log(position)
+ var lng1
+ var lng2
+ position.forEach((item, index) => {
+ if (index == 0) {
+ lng1 = item.split(',')
+ } else if (index == 1) {
+ lng2 = item.split(',')
+ }
+ })
+
+ that.lng = (+lng1[0] + +lng2[0]) / 2
+ that.lat = (+lng1[1] + +lng2[1]) / 2
+ localStorage.setItem('POSITION_INFO', JSON.stringify({ lng: that.lng, lat: that.lat, timestamp: new Date().getTime() }))
+ // lng: '',
+ // lat: '',
+ // let code = cityList.find((item) => {
+ // return item.city == data.city
+ // }).code
+ },
+ })
+ },
+ sortList(type) {
+ console.log(type)
+ this.formvalue.lng = ''
+ this.formvalue.lat = ''
+ if (type == 'juli') {
+ this.formvalue.sortTag = 2
+ this.sortNum = 2
+ this.sortStr = '距离'
+ this.formvalue.lng = this.lng
+ this.formvalue.lat = this.lat
+ } else if (type == 'fuwufei') {
+ this.sortNum = 3
+ this.sortStr = '服务费'
+ this.formvalue.sortTag = 3
+ } else if (type == 'price') {
+ this.sortNum = 1
+ this.sortStr = '排序'
+ this.formvalue.sortTag = 1
+ }
+ this.getJobList()
+ },
},
}
@@ -2117,7 +2208,7 @@ export default {
span i {
font-size: 12px;
}
- > span:last-child {
+ .toggleFilter {
height: 24px;
padding: 0px 2px 0 4px;
line-height: 22px;
@@ -2137,6 +2228,22 @@ export default {
margin-left: 2px;
}
}
+ .sort {
+ width: 86px;
+ height: 22px;
+ margin-left: 16px;
+ display: inline-block;
+ text-align: center;
+ padding: 0px 2px 0 4px;
+ line-height: 20px;
+ border: 1px solid #ededed;
+ background-color: #f5f5f5;
+ border-radius: 0px;
+ color: #666;
+ cursor: pointer;
+ user-select: none;
+ }
+
> span:first-child {
display: flex;
align-items: center;
@@ -2182,6 +2289,7 @@ export default {
}
}
}
+
.filter-content {
overflow: hidden;
// background-color: skyblue;
@@ -2343,6 +2451,7 @@ export default {
}
}
}
+
.nodata {
overflow: hidden;
height: 230px;
@@ -2712,6 +2821,25 @@ export default {
}
}
}
+.sortClass {
+ .sortMenu {
+ text-align: center;
+ height: 46px;
+ line-height: 46px;
+ }
+ .ant-dropdown-menu-item {
+ width: 140px;
+ padding: 0 16px;
+ &:not(:last-child) {
+ .sortMenu {
+ border-bottom: 1px solid #eee;
+ }
+ }
+ }
+ .active.sortMenu {
+ color: #ff4400;
+ }
+}
.cityModal {
.inputBox {
display: flex;
diff --git a/src/components/Login/login.vue b/src/components/Login/login.vue
index b0ea4ab..23e608a 100644
--- a/src/components/Login/login.vue
+++ b/src/components/Login/login.vue
@@ -5,7 +5,7 @@
-

+