|
|
@ -183,7 +183,7 @@ |
|
|
|
<el-form-item label="签到有效范围(米)" |
|
|
|
prop="signInRadius" |
|
|
|
style="display: block" |
|
|
|
label-width="160px"> |
|
|
|
label-width="150px"> |
|
|
|
<el-input-number class="item_width_2" |
|
|
|
:min="0" |
|
|
|
v-model="formData.signInRadius" |
|
|
@ -193,80 +193,74 @@ |
|
|
|
</div> |
|
|
|
<div class="form_flex"> |
|
|
|
<div class="form_item"> |
|
|
|
<el-form-item label="活动位置" |
|
|
|
prop="longitude" |
|
|
|
label-width="150px" |
|
|
|
style="display: block"> |
|
|
|
<div style="width: 500px"> |
|
|
|
<el-select v-model="searchValueAct" |
|
|
|
filterable |
|
|
|
style="width: 330px" |
|
|
|
remote |
|
|
|
:reserve-keyword="true" |
|
|
|
placeholder="请输入关键词" |
|
|
|
:remote-method="remoteMethodAct" |
|
|
|
:loading="loadingAct"> |
|
|
|
<el-option v-for="(item,index) in searchOptionsAct" |
|
|
|
@click.native="handleClickKeyAct(index)" |
|
|
|
:key="item.value" |
|
|
|
:label="item.label" |
|
|
|
:value="item.value"> |
|
|
|
</el-option> |
|
|
|
</el-select> |
|
|
|
<div id="app_heart_act" |
|
|
|
<el-form-item label="活动地点" |
|
|
|
prop="actAddress" |
|
|
|
label-width="150px"> |
|
|
|
<div style="width: 400px"> |
|
|
|
<el-input class="item_width_4" |
|
|
|
maxlength="100" |
|
|
|
style="width: 330px" |
|
|
|
show-word-limit |
|
|
|
placeholder="请输入所在地址" |
|
|
|
v-model="formData.actAddress"> |
|
|
|
</el-input> |
|
|
|
<el-button style="margin-left: 10px" |
|
|
|
type="default" |
|
|
|
size="small" |
|
|
|
@click="handleSearchMapAct">查询</el-button> |
|
|
|
<div id="map_act_id" |
|
|
|
class="div_map"></div> |
|
|
|
<!-- <div style="margin-top: 10px"> |
|
|
|
<span>经度</span> |
|
|
|
<el-input class="item_width_3" |
|
|
|
maxlength="50" |
|
|
|
placeholder="请输入经度" |
|
|
|
v-model="formData.actLatitude"> |
|
|
|
</el-input> |
|
|
|
<span style="margin-left: 20px">纬度</span> |
|
|
|
<el-input class="item_width_3" |
|
|
|
maxlength="50" |
|
|
|
placeholder="请输入纬度" |
|
|
|
v-model="formData.actLongitude"> |
|
|
|
</el-input> |
|
|
|
</div> --> |
|
|
|
</div> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="活动地址 " |
|
|
|
prop="actAddress" |
|
|
|
label-width="150px" |
|
|
|
style="display: block"> |
|
|
|
<el-input class="item_width_1" |
|
|
|
maxlength="50" |
|
|
|
show-word-limit |
|
|
|
placeholder="请输入位置 " |
|
|
|
v-model="formData.actAddress"> |
|
|
|
</el-input> |
|
|
|
</el-form-item> |
|
|
|
</div> |
|
|
|
<div class="form_item"> |
|
|
|
<el-form-item label="签到位置" |
|
|
|
prop="longitude" |
|
|
|
label-width="150px" |
|
|
|
style="display: block"> |
|
|
|
<div style="width: 500px"> |
|
|
|
<el-select v-model="searchValueSignin" |
|
|
|
filterable |
|
|
|
style="width: 500px" |
|
|
|
remote |
|
|
|
:reserve-keyword="true" |
|
|
|
placeholder="请输入关键词" |
|
|
|
:remote-method="remoteMethodSignin" |
|
|
|
:loading="loadingSignin"> |
|
|
|
<el-option v-for="(item,index) in searchOptionsSignin" |
|
|
|
@click.native="handleClickKeySignin(index)" |
|
|
|
:key="item.value" |
|
|
|
:label="item.label" |
|
|
|
:value="item.value"> |
|
|
|
</el-option> |
|
|
|
</el-select> |
|
|
|
<div id="app_heart_signin" |
|
|
|
<el-form-item label="签到地点" |
|
|
|
prop="signInAddress" |
|
|
|
label-width="150px"> |
|
|
|
<div style="width: 400px"> |
|
|
|
<el-input class="item_width_4" |
|
|
|
maxlength="100" |
|
|
|
style="width: 330px" |
|
|
|
show-word-limit |
|
|
|
placeholder="请输入所在地址" |
|
|
|
v-model="formData.signInAddress"> |
|
|
|
</el-input> |
|
|
|
<el-button style="margin-left: 10px" |
|
|
|
type="default" |
|
|
|
size="small" |
|
|
|
@click="handleSearchMapSignin">查询</el-button> |
|
|
|
<div id="map_signin_id" |
|
|
|
class="div_map"></div> |
|
|
|
<!-- <div style="margin-top: 10px"> |
|
|
|
<span>经度</span> |
|
|
|
<el-input class="item_width_3" |
|
|
|
maxlength="50" |
|
|
|
placeholder="请输入经度" |
|
|
|
v-model="formData.signInLatitude"> |
|
|
|
</el-input> |
|
|
|
<span style="margin-left: 20px">纬度</span> |
|
|
|
<el-input class="item_width_3" |
|
|
|
maxlength="50" |
|
|
|
placeholder="请输入纬度" |
|
|
|
v-model="formData.signInLongitude"> |
|
|
|
</el-input> |
|
|
|
</div> --> |
|
|
|
</div> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="签到地址 " |
|
|
|
prop="signInAddress" |
|
|
|
label-width="150px" |
|
|
|
style="display: block"> |
|
|
|
<el-input class="item_width_1" |
|
|
|
maxlength="50" |
|
|
|
show-word-limit |
|
|
|
placeholder="请输入位置 " |
|
|
|
v-model="formData.signInAddress"> |
|
|
|
</el-input> |
|
|
|
</el-form-item> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<el-form-item label="活动详情" |
|
|
@ -340,12 +334,20 @@ import { Loading } from "element-ui"; // 引入Loading服务 |
|
|
|
import { requestPost } from "@/js/dai/request"; |
|
|
|
|
|
|
|
import Tinymce from "@c/tinymce2/index.vue"; |
|
|
|
import daiMap from "@/utils/dai-map"; |
|
|
|
|
|
|
|
let loading; // 加载动画 |
|
|
|
|
|
|
|
var map_act; |
|
|
|
var search_act; |
|
|
|
var markers_act; |
|
|
|
var infoWindowList_act; |
|
|
|
var geocoder_act; // 新建一个正逆地址解析类 |
|
|
|
|
|
|
|
var map_signin; |
|
|
|
var search_signin; |
|
|
|
var markers_signin; |
|
|
|
var infoWindowList_signin; |
|
|
|
var geocoder_signin; // 新建一个正逆地址解析类 |
|
|
|
|
|
|
|
export default { |
|
|
|
data () { |
|
|
@ -384,16 +386,6 @@ export default { |
|
|
|
}; |
|
|
|
return { |
|
|
|
formType: "add", //表单操作类型 add新增,edit编辑,detail详情 |
|
|
|
searchOptionsAct: [], |
|
|
|
searchValueAct: '', |
|
|
|
resultListAct: [], |
|
|
|
loadingAct: false, |
|
|
|
|
|
|
|
searchOptionsSignin: [], |
|
|
|
searchValueSignin: '', |
|
|
|
resultListSignin: [], |
|
|
|
loadingSignin: false, |
|
|
|
|
|
|
|
btnDisable: false, |
|
|
|
customerId: "", |
|
|
|
actId: "", |
|
|
@ -476,13 +468,15 @@ export default { |
|
|
|
mounted () { |
|
|
|
this.customerId = localStorage.getItem("customerId"); |
|
|
|
this.loadSponsorlist(); |
|
|
|
this.initMap(); |
|
|
|
|
|
|
|
// this.replayImgList.push() |
|
|
|
}, |
|
|
|
|
|
|
|
methods: { |
|
|
|
async initForm (type, actId) { |
|
|
|
this.$refs.ref_form.resetFields(); |
|
|
|
let { latitude, longitude } = this.$store.state.user; |
|
|
|
|
|
|
|
this.formType = type; |
|
|
|
if (actId) { |
|
|
|
this.startLoading(); |
|
|
@ -493,26 +487,9 @@ export default { |
|
|
|
} else { |
|
|
|
this.actId = ""; |
|
|
|
this.formData.actId = ""; |
|
|
|
this.formData.actLatitude = latitude |
|
|
|
this.formData.actLongitude = longitude |
|
|
|
this.formData.signInLatitude = latitude |
|
|
|
this.formData.signInLongitude = longitude |
|
|
|
// this.formData = JSON.parse(JSON.stringify(this.formDataTemp)); |
|
|
|
// this.agencyIdArray = this.formData.sponsorPath.split(',') |
|
|
|
} |
|
|
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
if (!map_act) { |
|
|
|
this.initMap(this.formData.actLatitude, this.formData.actLongitude, this.formData.signInLatitude, this.formData.signInLongitude) |
|
|
|
} else { |
|
|
|
map_act.setCenter(this.formData.actLatitude, this.formData.actLongitude); |
|
|
|
map_act.setMarker(this.formData.actLatitude, this.formData.actLongitude); |
|
|
|
map_signin.setCenter(this.formData.signInLatitude, this.formData.signInLongitude); |
|
|
|
map_signin.setMarker(this.formData.signInLatitude, this.formData.signInLongitude); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
//获取主办方 |
|
|
@ -712,170 +689,188 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
// 地图初始化函数,本例取名为init,开发者可根据实际情况定义 |
|
|
|
initMap (latitude1, longitude1, latitude2, longitude2) { |
|
|
|
|
|
|
|
map_act = new daiMap( |
|
|
|
document.getElementById("app_heart_act"), |
|
|
|
{ latitude1, longitude1 }, |
|
|
|
{ |
|
|
|
zoom: 16.2, // 设置地图缩放级别 |
|
|
|
pitch: 43.5, // 设置俯仰角 |
|
|
|
rotation: 45, // 设置地图旋转角度 |
|
|
|
} |
|
|
|
); |
|
|
|
map_signin = new daiMap( |
|
|
|
document.getElementById("app_heart_signin"), |
|
|
|
{ latitude2, longitude2 }, |
|
|
|
initMap () { |
|
|
|
// 定义地图中心点坐标 |
|
|
|
var center = new window.TMap.LatLng(36.0722275, 120.38945519); |
|
|
|
// 定义map变量,调用 TMap.Map() 构造函数创建地图 |
|
|
|
map_act = new window.TMap.Map(document.getElementById("map_act_id"), { |
|
|
|
center: center, // 设置地图中心点坐标 |
|
|
|
zoom: 16.2, // 设置地图缩放级别 |
|
|
|
pitch: 43.5, // 设置俯仰角 |
|
|
|
rotation: 45, // 设置地图旋转角度 |
|
|
|
}); |
|
|
|
map_signin = new window.TMap.Map( |
|
|
|
document.getElementById("map_signin_id"), |
|
|
|
{ |
|
|
|
center: center, // 设置地图中心点坐标 |
|
|
|
zoom: 16.2, // 设置地图缩放级别 |
|
|
|
pitch: 43.5, // 设置俯仰角 |
|
|
|
rotation: 45, // 设置地图旋转角度 |
|
|
|
} |
|
|
|
); |
|
|
|
|
|
|
|
search_act = new window.TMap.service.Search({ pageSize: 10 }); |
|
|
|
// 新建一个地点搜索类 |
|
|
|
markers_act = new TMap.MultiMarker({ |
|
|
|
map: map_act, |
|
|
|
geometries: [], |
|
|
|
}); |
|
|
|
infoWindowList_act = Array(10); |
|
|
|
|
|
|
|
geocoder_act = new TMap.service.Geocoder(); // 新建一个正逆地址解析类 |
|
|
|
|
|
|
|
search_signin = new window.TMap.service.Search({ pageSize: 10 }); |
|
|
|
// 新建一个地点搜索类 |
|
|
|
markers_signin = new TMap.MultiMarker({ |
|
|
|
map: map_signin, |
|
|
|
geometries: [], |
|
|
|
}); |
|
|
|
infoWindowList_signin = Array(10); |
|
|
|
|
|
|
|
geocoder_signin = new TMap.service.Geocoder(); // 新建一个正逆地址解析类 |
|
|
|
|
|
|
|
// 监听地图平移结束 |
|
|
|
map_act.on("dragend", (e) => { |
|
|
|
map_act.on("panend", (e) => { |
|
|
|
this.handleMoveCenterAct(e); |
|
|
|
}); |
|
|
|
|
|
|
|
map_act.setCenter(latitude1, longitude1); |
|
|
|
map_act.setMarker(latitude1, longitude1); |
|
|
|
this.handleMoveCenterAct(); |
|
|
|
|
|
|
|
// 监听地图平移结束 |
|
|
|
map_signin.on("dragend", (e) => { |
|
|
|
map_signin.on("panend", (e) => { |
|
|
|
this.handleMoveCenterSignin(e); |
|
|
|
}); |
|
|
|
this.handleMoveCenterSignin(); |
|
|
|
}, |
|
|
|
|
|
|
|
map_signin.setCenter(latitude2, longitude2); |
|
|
|
map_signin.setMarker(latitude2, longitude2); |
|
|
|
|
|
|
|
setMarkerAct (lat, lng) { |
|
|
|
markers_act.setGeometries([]); |
|
|
|
markers_act.add([ |
|
|
|
{ |
|
|
|
id: "4", |
|
|
|
styleId: "marker", |
|
|
|
position: new TMap.LatLng(lat, lng), |
|
|
|
properties: { |
|
|
|
title: "marker4", |
|
|
|
}, |
|
|
|
}, |
|
|
|
]); |
|
|
|
}, |
|
|
|
|
|
|
|
handleSearchMapAct () { |
|
|
|
infoWindowList_act.forEach((infoWindow) => { |
|
|
|
infoWindow.close(); |
|
|
|
}); |
|
|
|
infoWindowList_act.length = 0; |
|
|
|
markers_act.setGeometries([]); |
|
|
|
// 在地图显示范围内以给定的关键字搜索地点 |
|
|
|
search_act |
|
|
|
.searchNearby({ |
|
|
|
keyword: this.formData.actAddress, |
|
|
|
radius: 1000, |
|
|
|
autoExtend: true, |
|
|
|
center: map_act.getCenter(), |
|
|
|
}) |
|
|
|
.then((result) => { |
|
|
|
let { data } = result; |
|
|
|
if (Array.isArray(data) && data.length > 0) { |
|
|
|
const { |
|
|
|
location: { lat, lng }, |
|
|
|
} = data[0]; |
|
|
|
map_act.setCenter(new TMap.LatLng(lat, lng)); |
|
|
|
this.setMarkerAct(lat, lng); |
|
|
|
this.formData.actLatitude = lat; |
|
|
|
this.formData.actLongitude = lng; |
|
|
|
} else { |
|
|
|
this.$message.error("未检索到相关位置坐标"); |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
async handleMoveCenterAct () { |
|
|
|
handleMoveCenterAct (e) { |
|
|
|
//修改地图中心点 |
|
|
|
const { lat, lng } = map_act.getCenter(); |
|
|
|
const center = map_act.getCenter(); |
|
|
|
const lat = center.getLat(); |
|
|
|
const lng = center.getLng(); |
|
|
|
this.formData.actLatitude = lat; |
|
|
|
this.formData.actLongitude = lng; |
|
|
|
map_act.setMarker(lat, lng); |
|
|
|
|
|
|
|
let { msg, data } = await map_act.getAddress(lat, lng); |
|
|
|
if (msg == "success") { |
|
|
|
this.formData.actAddress = data.address |
|
|
|
this.searchValueAct = data.address |
|
|
|
this.searchOptionsAct = [] |
|
|
|
|
|
|
|
this.setMarkerAct(lat, lng); |
|
|
|
|
|
|
|
if (e && e.originalEvent) { |
|
|
|
geocoder_act |
|
|
|
.getAddress({ location: new TMap.LatLng(lat, lng) }) // 将给定的坐标位置转换为地址 |
|
|
|
.then((result) => { |
|
|
|
this.formData.actAddress = result.result.address; |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
async handleMoveCenterSignin () { |
|
|
|
//修改地图中心点 |
|
|
|
const { lat, lng } = map_signin.getCenter(); |
|
|
|
this.formData.signInLatitude = lat; |
|
|
|
this.formData.signInLongitude = lng; |
|
|
|
map_signin.setMarker(lat, lng); |
|
|
|
|
|
|
|
let { msg, data } = await map_signin.getAddress(lat, lng); |
|
|
|
if (msg == "success") { |
|
|
|
this.formData.signInAddress = data.address |
|
|
|
this.searchValueSignin = data.address |
|
|
|
this.searchOptionsSignin = [] |
|
|
|
|
|
|
|
} |
|
|
|
setMarkerSignin (lat, lng) { |
|
|
|
markers_signin.setGeometries([]); |
|
|
|
markers_signin.add([ |
|
|
|
{ |
|
|
|
id: "4", |
|
|
|
styleId: "marker", |
|
|
|
position: new TMap.LatLng(lat, lng), |
|
|
|
properties: { |
|
|
|
title: "marker4", |
|
|
|
}, |
|
|
|
}, |
|
|
|
]); |
|
|
|
}, |
|
|
|
|
|
|
|
async remoteMethodAct (query) { |
|
|
|
|
|
|
|
if (query !== '') { |
|
|
|
this.loadingAct = true; |
|
|
|
|
|
|
|
const { msg, data } = await map_act.searchNearby(query); |
|
|
|
this.loadingAct = false; |
|
|
|
this.resultListAct = [] |
|
|
|
|
|
|
|
if (msg == "success" && data.resultList && data.resultList.length > 0) { |
|
|
|
|
|
|
|
if (data.resultList && data.resultList.length > 0) { |
|
|
|
this.resultListAct = data.resultList |
|
|
|
this.searchOptionsAct = this.resultListAct.map(item => { |
|
|
|
return { value: `${item.hotPointID}`, label: `${item.address + item.name}` }; |
|
|
|
|
|
|
|
}); |
|
|
|
handleSearchMapSignin () { |
|
|
|
infoWindowList_signin.forEach((infoWindow) => { |
|
|
|
infoWindow.close(); |
|
|
|
}); |
|
|
|
infoWindowList_signin.length = 0; |
|
|
|
markers_signin.setGeometries([]); |
|
|
|
// 在地图显示范围内以给定的关键字搜索地点 |
|
|
|
search_signin |
|
|
|
.searchNearby({ |
|
|
|
keyword: this.formData.signInAddress, |
|
|
|
radius: 1000, |
|
|
|
autoExtend: true, |
|
|
|
center: map_signin.getCenter(), |
|
|
|
}) |
|
|
|
.then((result) => { |
|
|
|
let { data } = result; |
|
|
|
if (Array.isArray(data) && data.length > 0) { |
|
|
|
const { |
|
|
|
location: { lat, lng }, |
|
|
|
} = data[0]; |
|
|
|
map_signin.setCenter(new TMap.LatLng(lat, lng)); |
|
|
|
this.setMarkerSignin(lat, lng); |
|
|
|
this.formData.signInLatitude = lat; |
|
|
|
this.formData.signInLongitude = lng; |
|
|
|
} else { |
|
|
|
this.$message.error("未检索到相关位置坐标"); |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.searchOptionsAct = [ |
|
|
|
{ |
|
|
|
value: '0', |
|
|
|
label: '未检索到结果' |
|
|
|
} |
|
|
|
] |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.searchOptionsAct = []; |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
async remoteMethodSignin (query) { |
|
|
|
|
|
|
|
if (query !== '') { |
|
|
|
this.loadingSign = true; |
|
|
|
|
|
|
|
const { msg, data } = await map_signin.searchNearby(query); |
|
|
|
this.loadingSign = false; |
|
|
|
this.resultListSignin = [] |
|
|
|
|
|
|
|
if (msg == "success" && data.resultList && data.resultList.length > 0) { |
|
|
|
|
|
|
|
if (data.resultList && data.resultList.length > 0) { |
|
|
|
this.resultListSignin = data.resultList |
|
|
|
this.searchOptionsSignin = this.resultListSignin.map(item => { |
|
|
|
return { value: `${item.hotPointID}`, label: `${item.address + item.name}` }; |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.searchOptionsSignin = [ |
|
|
|
{ |
|
|
|
value: '0', |
|
|
|
label: '未检索到结果' |
|
|
|
} |
|
|
|
] |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.searchOptionsSignin = []; |
|
|
|
handleMoveCenterSignin (e) { |
|
|
|
//修改地图中心点 |
|
|
|
const center = map_signin.getCenter(); |
|
|
|
const lat = center.getLat(); |
|
|
|
const lng = center.getLng(); |
|
|
|
this.formData.signInLatitude = lat; |
|
|
|
this.formData.signInLongitude = lng; |
|
|
|
this.setMarkerSignin(lat, lng); |
|
|
|
|
|
|
|
if (e && e.originalEvent) { |
|
|
|
geocoder_signin |
|
|
|
.getAddress({ location: new TMap.LatLng(lat, lng) }) // 将给定的坐标位置转换为地址 |
|
|
|
.then((result) => { |
|
|
|
this.formData.signInAddress = result.result.address; |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
handleClickKeyAct (index) { |
|
|
|
let selPosition = this.resultListAct[index] |
|
|
|
let lonlat = selPosition.lonlat.split(" ") |
|
|
|
map_act.setCenter(lonlat[1], lonlat[0]); |
|
|
|
map_act.setMarker(lonlat[1], lonlat[0]); |
|
|
|
this.formData.actLatitude = lonlat[1]; |
|
|
|
this.formData.actLongitude = lonlat[0]; |
|
|
|
this.formData.actAddress = selPosition.address + selPosition.name |
|
|
|
}, |
|
|
|
handleClickKeySignin (index) { |
|
|
|
let selPosition = this.resultListSignin[index] |
|
|
|
let lonlat = selPosition.lonlat.split(" ") |
|
|
|
map_signin.setCenter(lonlat[1], lonlat[0]); |
|
|
|
map_signin.setMarker(lonlat[1], lonlat[0]); |
|
|
|
this.formData.signInLatitude = lonlat[1]; |
|
|
|
this.formData.signInLongitude = lonlat[0]; |
|
|
|
this.formData.signInAddress = selPosition.address + selPosition.name |
|
|
|
}, |
|
|
|
handleCancle () { |
|
|
|
this.resetData(); |
|
|
|
this.$emit("dialogCancle"); |
|
|
|
}, |
|
|
|
|
|
|
|
resetData () { |
|
|
|
this.searchValueAct = '' |
|
|
|
this.searchOptionsAct = [] |
|
|
|
this.resultListAct = [] |
|
|
|
|
|
|
|
this.searchValueSignin = '' |
|
|
|
this.searchOptionsSignin = [] |
|
|
|
this.resultListSignin = [] |
|
|
|
|
|
|
|
this.actId = ""; |
|
|
|
this.replayImgList = []; |
|
|
|
this.agencyIdArray = []; |
|
|
|