You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

530 lines
22 KiB
Vue

<template>
<view>
<view class="f16 c3 fwb ml12 mt12">
<i class="iconfont icon-qiye" style="color: #027aff; margin-left: 10px"></i>
厂区地址
</view>
<view
class="weui-slidecells"
@tap="chooseMap2"
data-name="store"
:data-postitle="jobDetail.poses.store.posTitle"
:data-poscontent="jobDetail.poses.store.posContent"
:data-lat="jobDetail.poses.store.latitude"
:data-lng="jobDetail.poses.store.longitude"
:data-id="jobDetail.poses.store.id"
>
<view class="weui-slidecell">
<view class="va-center" style="width: 100%">
<view class="flex-1 lh24">
<view class="c3 fw500" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: calc(100vw - 80px)">
{{ jobDetail.poses.store.posTitle ? jobDetail.poses.store.posTitle : '无' }}
</view>
<view class="c9 f14 mt4" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: calc(100vw - 80px)">
{{ jobDetail.poses.store.posContent ? jobDetail.poses.store.posContent : '暂无地址信息' }}
</view>
</view>
<i class="iconfont icon-gengduo1 f16 lh13 dib"></i>
</view>
</view>
</view>
<block class="" v-if="jobDetail.jobPoses.interview.posContent" hover-class="none" :hover-stop-propagation="false">
<view class="f16 c3 fwb ml12 mt12">
<i class="iconfont icon-mianshi" style="color: #ff4400; margin-left: 10px"></i>
面试地址
</view>
<view
class="weui-slidecells"
@tap="chooseMap2"
data-name="interview"
:data-postitle="jobDetail.jobPoses.interview.posTitle"
:data-poscontent="jobDetail.jobPoses.interview.posContent"
:data-lat="jobDetail.jobPoses.interview.latitude"
:data-lng="jobDetail.jobPoses.interview.longitude"
:data-id="jobDetail.jobPoses.interview.id"
>
<view class="weui-slidecell">
<view class="va-center" style="width: 100%">
<view class="flex-1 lh24">
<view class="c3 fw500" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: calc(100vw - 80px)">
{{ jobDetail.jobPoses.interview.posTitle ? jobDetail.jobPoses.interview.posTitle : '无' }}
</view>
<view class="c9 f14 mt4" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: calc(100vw - 80px)">
{{ jobDetail.jobPoses.interview.posContent ? jobDetail.jobPoses.interview.posContent : '暂无地址信息' }}
</view>
</view>
<i class="iconfont icon-gengduo1 f16 lh13 dib"></i>
</view>
</view>
</view>
</block>
<block class="" v-if="jobDetail.jobPoses.room.posContent" hover-class="none" :hover-stop-propagation="false">
<view class="f16 c3 fwb ml12 mt12">
<i class="iconfont icon-sushe" style="color: #00bebe; margin-left: 10px"></i>
宿舍地址
</view>
<view
class="weui-slidecells"
@tap="chooseMap2"
data-name="room"
:data-postitle="jobDetail.jobPoses.room.posTitle"
:data-poscontent="jobDetail.jobPoses.room.posContent"
:data-lat="jobDetail.jobPoses.room.latitude"
:data-lng="jobDetail.jobPoses.room.longitude"
:data-id="jobDetail.jobPoses.room.id"
>
<view class="weui-slidecell">
<view class="va-center" style="width: 100%">
<view class="flex-1 lh24">
<view class="c3 fw500" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: calc(100vw - 80px)">
{{ jobDetail.jobPoses.room.posTitle ? jobDetail.jobPoses.room.posTitle : '无' }}
</view>
<view class="c9 f14 mt4" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: calc(100vw - 80px)">
{{ jobDetail.jobPoses.room.posContent ? jobDetail.jobPoses.room.posContent : '暂无地址信息' }}
</view>
</view>
<i class="iconfont icon-gengduo1 f16 lh13 dib"></i>
</view>
</view>
</view>
</block>
<block v-for="(item, index) in jobDetail.poses.others" :key="index">
<view class="f16 c3 fwb ml12 mt12">
<i class="iconfont icon-qitadizhi" style="color: #00bebe; margin-left: 10px"></i>
{{ item.posName }}
</view>
<view
class="weui-slidecells"
@tap="chooseMap2"
data-name="others"
:data-postitle="item.posTitle"
:data-poscontent="item.posContent"
:data-lat="item.latitude"
:data-lng="item.longitude"
:data-id="item.id"
>
<view class="weui-slidecell">
<view class="va-center" style="width: 100%">
<view class="flex-1 lh24">
<view class="c3 fw500" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: calc(100vw - 80px)">
{{ item.posTitle ? item.posTitle : '无' }}
</view>
<view class="c9 f14" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: calc(100vw - 80px)">
{{ item.posContent ? item.posContent : '暂无地址信息' }}
</view>
</view>
<i class="iconfont icon-gengduo1 f16 lh13 dib"></i>
</view>
</view>
</view>
</block>
<view class="subset" style="margin-top: 10px; display: none" hover-class="none" :hover-stop-propagation="false">
<view class="title display-flex fw500">
<view class="iconfont icon-zhuchangxinxi" style="margin-left: 10px; color: #027aff"></view>
驻场信息
</view>
<view class="navigator display-flex" style="padding: 8px 10px; background-color: #e8e8e8">
<view class="flex-1 pr">
<view class="copyBtn" @click.stop="setCopy">复制</view>
<view class="c065 f14" style="white-space: pre-wrap; line-height: 1.3">{{ onSiteRemark }}</view>
</view>
</view>
</view>
<view style="height: 40px"></view>
</view>
</template>
<script>
// pages/addressPage/index.js
// const { variableDeclaration } = require("jscodeshift");
const app = getApp();
var QQMapWX = require('../../../utils/qqmap-wx-jssdk.min');
var qqmapsdk;
export default {
data() {
return {
onSiteRemark: '',
jobDetail: {
poses: {
store: {
posTitle: '',
posContent: '',
latitude: '',
longitude: '',
id: ''
},
others: []
},
jobPoses: {
interview: {
posContent: '',
posTitle: '',
latitude: '',
longitude: '',
id: ''
},
room: {
posContent: '',
posTitle: '',
latitude: '',
longitude: '',
id: ''
}
}
},
addressList: {
storeAddress: {
color: '#0dcc91',
icon: 'icon-qiye',
name: '厂区地址',
addressName: '无',
address: '暂无详细地址'
},
meetingAddress: {
color: '#4DB54B',
icon: 'icon-jieren',
name: '接人地址',
addressName: '无',
address: '暂无详细地址'
},
interviewAddress: {
color: '#FF4400',
icon: 'icon-mianshi',
name: '面试地址',
addressName: '无',
address: '暂无详细地址'
}
}
};
}
/**
* 生命周期函数--监听页面加载
*/,
onLoad(options) {
var that = this;
qqmapsdk = new QQMapWX({
key: '5PTBZ-YI7C6-MZGS3-ES7QN-4T5O2-EJFVR'
});
console.log(uni.getStorageSync('addressList'));
uni.getStorage({
key: 'addressList',
success(res) {
that.setData({
jobDetail: res.data
});
console.log(res.data);
var data = res.data;
new Promise(function (resolve, reject) {
console.log(data);
var d1 = '';
var d2 = '';
var d3 = '';
if (data.store.lat != '') {
qqmapsdk.reverseGeocoder({
location: `${data.store.lat},${data.store.lng}`,
success: function (res) {
console.log(res);
d1 = res.result.formatted_addresses.recommend;
that.addressList['storeAddress'] = {
color: '#0dcc91',
icon: 'icon-qiye',
name: '企业地址',
addresss: data.store.detailPosition,
lat: data.store.lat,
lng: data.store.lng,
addressName: d1
};
that.setData({
addressList: that.addressList
});
}
});
}
if (data.storeJob.meettingAddr != '') {
qqmapsdk.reverseGeocoder({
location: `${data.storeJob.meettingLat},${data.storeJob.meettingLng}`,
success: function (res) {
console.log(res);
d2 = res.result.formatted_addresses.recommend;
that.addressList['meetingAddress'] = {
color: '#4DB54B',
icon: 'icon-jieren',
name: '接人地址',
addresss: data.storeJob.meettingAddr,
lat: data.storeJob.meettingLat,
lng: data.storeJob.meettingLng,
addressName: d2
};
that.setData({
addressList: that.addressList
});
}
});
}
if (data.storeJob.interviewAddress != '') {
qqmapsdk.reverseGeocoder({
location: `${data.storeJob.interviewLat},${data.storeJob.interviewLng}`,
success: function (res) {
console.log(res);
d3 = res.result.formatted_addresses.recommend;
that.addressList['interviewAddress'] = {
color: '#FF4400',
icon: 'icon-mianshi',
name: '面试地址',
addresss: data.storeJob.interviewAddr,
lat: data.storeJob.interviewLat,
lng: data.storeJob.interviewLng,
addressName: d3
};
that.setData({
addressList: that.addressList
});
}
});
console.log(that.addressList);
}
resolve();
})
.then(() => {
that.setData({
addressList: that.addressList
});
console.log(that.addressList);
})
.catch((err) => {
console.log(err);
});
}
});
// resolve();
// }).then(() => {
// setTimeout(function () {
// that.setData({
// addressList: that.data.addressList,
// });
// console.log(that.data.addressList);
// }, 800)
// });
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
console.log(uni.getStorageSync('onSiteRemark'));
var that = this;
that.setData({
onSiteRemark: uni.getStorageSync('onSiteRemark')
});
// new Promise((resolve, reject) => {
// let data = wx.getStorageSync("addressList");
// console.log("start Promise");
// if (data.store.lat != "") {
// qqmapsdk.reverseGeocoder({
// location: `${data.store.lat},${data.store.lng}`,
// success: function (res) {
// console.log(res);
// that.data.addressList.storeAddress["addressName"] = res.result.formatted_addresses.recommend;
// }
// })
// }
// if (data.storeJob.meettingLat != "") {
// qqmapsdk.reverseGeocoder({
// location: `${data.storeJob.meettingLat},${data.storeJob.meettingLng}`,
// success: function (res) {
// console.log(res);
// that.data.addressList.meetingAddress["addressName"] = res.result.formatted_addresses.recommend;
// }
// })
// }
// if (data.storeJob.interviewLat != "") {
// qqmapsdk.reverseGeocoder({
// location: `${data.storeJob.interviewLat},${data.storeJob.interviewLng}`,
// success: function (res) {
// console.log(res);
// that.data.addressList.interviewAddress["addressName"] = res.result.formatted_addresses.recommend;
// }
// })
// }
// resolve("resolved");
// }).then(() => {
// that.setData({
// addressList: that.data.addressList,
// });
// console.log(that.data.addressList)
// })
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
methods: {
toMap(e) {
var that = this;
uni.setClipboardData({
data: that.onSiteRemark,
success(res) {
uni.getClipboardData({
success(res) {
uni.showToast({
title: '内容已复制',
icon: 'none',
duration: 1500
});
console.log(res.data); // data
// wx.hideToast()
// wx.showLoading({
// title: "加载中",
// });
}
// ,
// complete:()=>{
// wx.hideToast()
// }
});
}
});
console.log(e.currentTarget.dataset.info.lat);
if (app.globalData.isEmptyCheck(e.currentTarget.dataset.info.lat)) {
return;
}
console.log(e);
var address = e.currentTarget.dataset.info.addresss;
let lat = e.currentTarget.dataset.info.lat;
var formatted_addresses = '';
// wx.getStorageSync("addressList").store.aliasName;
console.log(address);
qqmapsdk.reverseGeocoder({
// location: `${e.currentTarget.dataset.info.lat ? e.currentTarget.dataset.info.lat : "39.909115"},${e.currentTarget.dataset.info.lng ? e.currentTarget.dataset.info.lng : "116.397407"}`,
location: `${e.currentTarget.dataset.info.lat},${e.currentTarget.dataset.info.lng}`,
success: function (res) {
console.log(res);
formatted_addresses = res.result.formatted_addresses.recommend;
uni.getLocation({
type: 'gcj02',
//返回可以用于wx.openLocation的经纬度
success(res) {
console.log(formatted_addresses);
console.log(lat);
console.log(address);
uni.openLocation({
latitude: e.currentTarget.dataset.info.lat ? e.currentTarget.dataset.info.lat - 0 : 39.909115,
longitude: e.currentTarget.dataset.info.lng ? e.currentTarget.dataset.info.lng - 0 : 116.397407,
name: formatted_addresses,
address: address ? address : '',
scale: 15
});
},
complete(res) {
uni.hideLoading();
console.log(1123213);
}
});
},
fail(res) {
console.log(res);
}
});
},
setCopy() {
var that = this;
uni.setClipboardData({
data: that.onSiteRemark,
success(res) {
uni.getClipboardData({
success(res) {
console.log(res.data); // data
uni.showToast({
title: '内容已复制',
icon: 'none',
duration: 1500
});
}
});
}
});
},
chooseMap2(e) {
var that = this;
setTimeout(() => {
console.log(e.currentTarget.dataset.lat);
if (e.currentTarget.dataset.lat == '') {
return;
}
let name = e.currentTarget.dataset.postitle;
let content = e.currentTarget.dataset.poscontent;
let lat = e.currentTarget.dataset.lat - 0;
let lng = e.currentTarget.dataset.lng - 0;
uni.openLocation({
latitude: lat,
longitude: lng,
name: name,
address: content,
scale: 15
});
}, 200);
// wx.setClipboardData({
// data: that.data.onSiteRemark,
// success (res) {
// wx.getClipboardData({
// success (res) {
// wx.showToast({
// title: '内容已复制',
// icon: 'none',
// duration: 1500
// })
// console.log(res.data) // data
// // wx.hideToast()
// // wx.showLoading({
// // title: "加载中",
// // });
// }
// // ,
// // complete:()=>{
// // wx.hideToast()
// // }
// })
// }
// })
},
/**
* 用户点击右上角分享
*/
onShareAppMessage1() {}
}
};
</script>
<style>
@import './index.css';
</style>