活动地图

master
lion 4 years ago
parent 46169e5f25
commit 07c135f75e

@ -7,6 +7,8 @@
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= webpackConfig.name %></title>
<script charset="utf-8" src="https://map.qq.com/api/gljs?v=2.exp&key=4VBBZ-HAA3X-QKI46-7GAL2-LQEOT-BEBKN"></script>
<script charset="utf-8" src="http://map.qq.com/api/js?v=2.exp&key=4VBBZ-HAA3X-QKI46-7GAL2-LQEOT-BEBKN"></script>
<script src="http://3gimg.qq.com/lightmap/components/geolocation/geolocation.min.js"></script>
</head>
<body>
<noscript>

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

@ -14,6 +14,7 @@
</slot>
</LxHeader>
</div>
<div class="table-tree">
<el-table :data="tableData" :height="tableHeight" style="width: 100%">
<el-table-column type="index" width="50" label="序号" align="center"> </el-table-column>
@ -25,8 +26,7 @@
style="margin-left: 10px;">订单</Button>
<Button ghost size="small" @click="edit(scope.row)" type="primary"
style="margin-left: 10px;">编辑</Button>
<Button ghost size="small" type="error" @click="del(scope.row)"
style="margin-left: 10px;">删除</Button>
<Button ghost size="small" type="error" @click="del(scope.row)" style="margin-left: 10px;">删除</Button>
<Button v-if="scope.row['status']==1" ghost size="small" type="info" @click="changeStatus(scope.row)"
style="margin-left: 10px;">下架</Button>
<Button v-if="scope.row['status']==0" ghost size="small" type="warning" @click="changeStatus(scope.row)"
@ -34,7 +34,7 @@
</div>
<div v-else-if="column.type=='dateRange'">
{{scope.row["start_time"]+"至"+scope.row["end_time"]}}
{{scope.row["start_time"]+"-"+changeEndTime(scope.row["end_time"])}}
</div>
<div v-else-if="column.type=='status'">
<el-tag v-if="scope.row['status']==1" type="" effect="dark">
@ -66,10 +66,7 @@
<el-col :span="10" :offset="4">
<el-form-item label="所属区域" prop="area">
<el-select v-model="form.area" placeholder="请选择所属区域" style="width:100%">
<el-option
v-for="item in parameters.activityArea"
:key="item.value"
:label="item.value"
<el-option v-for="item in parameters.activityArea" :key="item.value" :label="item.value"
:value="item.id">
</el-option>
</el-select>
@ -78,10 +75,7 @@
<el-col :span="10">
<el-form-item label="关联类型" prop="type">
<el-select v-model="form.type" placeholder="请选择关联类型" style="width:100%">
<el-option
v-for="item in parameters.activityType"
:key="item.value"
:label="item.value"
<el-option v-for="item in parameters.activityType" :key="item.value" :label="item.value"
:value="item.id">
</el-option>
</el-select>
@ -90,10 +84,7 @@
<el-col :span="10" :offset="4">
<el-form-item label="关联内容" prop="con">
<el-select v-model="form.form" placeholder="请选择关联内容" style="width:100%">
<el-option
v-for="item in parameters.activityCon"
:key="item.value"
:label="item.value"
<el-option v-for="item in parameters.activityCon" :key="item.value" :label="item.value"
:value="item.id">
</el-option>
</el-select>
@ -119,39 +110,33 @@
<el-input v-model="form.latitude" placeholder="请填写地址纬度" autocomplete="off"></el-input>
</el-form-item>
</el-col>
<el-col :span="20" :offset="2">
<div id="containers" style="width:100%;height:300px;margin-bottom:20px"></div>
</el-col>
<el-col :span="8">
<el-form-item label="开始时间" prop="start_time">
<el-date-picker
style="width:100%"
v-model="form.start_time"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择活动开始时间">
<el-date-picker style="width:100%" v-model="form.start_time" type="datetime"
value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择活动开始时间" @change="isShowTime">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="结束时间" prop="end_time">
<el-time-select
style="width:100%"
placeholder="结束时间"
v-model="form.end_time"
<el-time-select style="width:100%" placeholder="结束时间" value-format="HH:mm:ss" v-model="form.end_time"
:picker-options="{
start: '00:00',
step: '00:15',
end: '24:00',
minTime: showTime
}">
</el-time-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="预定截止" prop="end_plan">
<el-date-picker
style="width:100%"
v-model="form.end_plan"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择预定截止时间">
<el-date-picker style="width:100%" v-model="form.end_plan" type="datetime"
value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择预定截止时间">
</el-date-picker>
</el-form-item>
</el-col>
@ -168,10 +153,7 @@
<el-col :span="8">
<el-form-item label="目标群体" prop="group">
<el-select v-model="form.target" placeholder="请选择目标群体" style="width:100%">
<el-option
v-for="item in parameters.activityGroup"
:key="item.value"
:label="item.value"
<el-option v-for="item in parameters.activityGroup" :key="item.value" :label="item.value"
:value="item.id">
</el-option>
</el-select>
@ -179,70 +161,36 @@
</el-col>
</el-row>
<el-form-item label="海报图" prop="cover">
<el-upload
action="/api/admin/upload-file"
list-type="picture-card"
:file-list="coverlist"
ref="pictureUpload"
:limit="1"
:auto-upload="true"
:data="uploadOther"
:on-success="function(responsose,file,fileList) {return handlesuccess(responsose,file,fileList,1)}"
>
<el-upload action="/api/admin/upload-file" list-type="picture-card" :file-list="coverlist" ref="pictureUpload"
:limit="1" :auto-upload="true" :data="uploadOther"
:on-success="function(responsose,file,fileList) {return handlesuccess(responsose,file,fileList,1)}">
<i slot="default" class="el-icon-plus"></i>
<div slot="file" slot-scope="{file}">
<img
class="el-upload-list__item-thumbnail"
:src="file.url" alt=""
>
<img class="el-upload-list__item-thumbnail" :src="file.url" alt="">
<span class="el-upload-list__item-actions">
<span
class="el-upload-list__item-preview"
@click="handlePictureCardPreview(file)"
>
<span class="el-upload-list__item-preview" @click="handlePictureCardPreview(file)">
<i class="el-icon-zoom-in"></i>
</span>
<span
v-if="!disabled"
class="el-upload-list__item-delete"
@click="handleRemove(file)"
>
<span v-if="!disabled" class="el-upload-list__item-delete" @click="handleRemove(file)">
<i class="el-icon-delete"></i>
</span>
</span>
</div>
</el-upload>
</el-form-item>
<el-form-item label="banner图(最多三张)" prop="banners_list">
<el-upload
action="/api/admin/upload-file"
list-type="picture-card"
:file-list="bannersList"
ref="pictureUploads"
:limit="3"
:auto-upload="true"
:data="uploadOther"
:on-success="function(responsose,file,fileList) {return handlesuccess(responsose,file,fileList,2)}"
>
<el-form-item label="轮播图(最多三张)" prop="banners_list">
<el-upload action="/api/admin/upload-file" list-type="picture-card" :file-list="bannersList"
ref="pictureUploads" :limit="3" :auto-upload="true" :data="uploadOther"
:on-success="function(responsose,file,fileList) {return handlesuccess(responsose,file,fileList,2)}">
<i slot="default" class="el-icon-plus"></i>
<div slot="file" slot-scope="{file}">
<img
class="el-upload-list__item-thumbnail"
:src="file.url" alt=""
>
<img class="el-upload-list__item-thumbnail" :src="file.url" alt="">
<span class="el-upload-list__item-actions">
<span
class="el-upload-list__item-preview"
@click="handlePictureCardPreview(file)"
>
<span class="el-upload-list__item-preview" @click="handlePictureCardPreview(file)">
<i class="el-icon-zoom-in"></i>
</span>
<span
v-if="!disabled"
class="el-upload-list__item-delete"
@click="handleRemove(file)"
>
<span v-if="!disabled" class="el-upload-list__item-delete" @click="handleRemove(file)">
<i class="el-icon-delete"></i>
</span>
</span>
@ -367,6 +315,7 @@
latitude: "",
banners_list: []
},
showTime: "",
coverlist: [],
bannersList: [],
// fileList:[],
@ -413,20 +362,107 @@
required: true,
message: '请输入活动名称',
trigger: 'blur'
}],
longitude: [{
required: true,
message: '请输入经度',
trigger: 'blur'
}],
latitude: [{
required: true,
message: '请输入纬度',
trigger: 'blur'
}],
start_time: [{
required: true,
message: '请选择开始时间',
trigger: 'blur'
}],
end_time: [{
required: true,
message: '请选择结束时间',
trigger: 'blur'
}],
end_plan: [{
required: true,
message: '请选择截止日期',
trigger: 'blur'
}]
},
markerLayer: {},
map: {},
imgsrc: "/src/assets/imgs/ditu.png"
}
},
mounted() {
},
destroyed() {
},
beforeUpdate() {
},
created() {
this.uploadOther.token = getToken();
this.initLoad();
this.load();
},
watch: {
dialogFormVisible(newVal, oldVal) {
if (newVal == true) {
let that = this;
that.markerLayer = new TMap.MultiMarker({});
that.initMap();
}
}
},
methods: {
initMap() {
//
// if (!!this.map) {
// this.map.destroy();
// }
this.$nextTick(() => {
let that = this;
console.log(window); // window
var center = new window.TMap.LatLng(31.302377, 120.625826)
//
var map = new window.TMap.Map("containers", {
zoom: 18, //
center: center, //
});
console.log(map);
this.map = map;
map.on("click", (e) => {
this.markerLayer.setGeometries([]);
const position = e.latLng;
that.form.longitude = position.lng,
that.form.latitude = position.lat,
this.addImgMarker(position);
});
})
},
addImgMarker(data) {
this.markerLayer = new TMap.MultiMarker({
map: this.map,
//
styles: {
//styleId"myStyle"stylesstyleId
myStyle: new TMap.MarkerStyle({
width: 25, //
height: 35, //
src: this.imgsrc, //
//
anchor: {
x: 16,
y: 32
},
}),
},
});
},
initLoad() {
var that = this;
var clientHeight = document.documentElement.clientHeight
@ -453,8 +489,10 @@
info(obj) {
var that = this;
get(obj.id).then(res => {
that.coverlist = [];
let result = Object.assign(that.form, res);
that.form = result;
that.showTime = result.start_time.substring(11, result.start_time.length);
that.form.end_time = result.end_time.substring(11, result.end_time.length);
result.cover_upload.coverType = "cover";
that.coverlist.push(result.cover_upload);
@ -479,13 +517,13 @@
if (obj) {
var that = this;
that.info(obj);
} else {
}
} else {}
this.dialogFormVisible = true;
},
submitForm(formName) {
var that = this;
that.form.end_time = that.form.start_time.substring(0,10)+" "+that.form.end_time+":00";
that.form.end_time = that.form.start_time.substring(0, 10) + " " + that.form.end_time;
this.$refs[formName].validate((valid) => {
if (valid) {
if (that.form.id) {
@ -599,9 +637,13 @@
for (var m of fileList) {
m.coverType = "poster";
if (m.response)
listUrl.push({"upload_id":m.response.id});
listUrl.push({
"upload_id": m.response.id
});
else
listUrl.push({"upload_id":m.id});
listUrl.push({
"upload_id": m.id
});
}
this.bannersList = fileList
this.form.banners_list = listUrl
@ -617,6 +659,16 @@
window.location.href = url
}
},
changeEndTime(val) {
if (val) {
val = val.substring(11, val.length);
return val
}
},
isShowTime(val) {
this.showTime = val.substring(11, val.length);
},
}
};
</script>

Loading…
Cancel
Save